Block of randomized trial

Hello guys
I’m still new on Python. Just one week ago I started to use it. I created a flow of randomly positioned stimuli that finally works, but now it works forever. I woul add some break or, better, I would split out the infinite flow of trial in block of 64 trial with a break after each block. How can I do it?

if your_trial_number % 64 == 0: # every 64th trial
    # implement some pause before continuing

1 Like

Thank you Michael, I have to type it in “begin routine”? or in “begin experiment”? and if in begin routine, I have to type close to the randomization string, right? I’m just trying now

Hi, I assumed that because this was in the Coding tag, you were writing your own experiment code rather than using Builder. In fact, I’m not even sure that it’s possible to have an infinite loop of trials in Builder. So to give useful help, can you explain exactly how you have your loop set up? Perhaps also send a screenshot of your flow panel.

1 Like

Dear Michael
yes I was using the code. Anyway I fixed it with your advice and it works. so thank you!!
last simple question is: how to end a routine? this is what I’m doing now.