Programming Task Question for Randomizing Questions Across 3 Blocks

I put together this task hoping to pull from a set of 195 questions randomly across 3 blocks. I want each participant to see all of the questions by the end of the experiment and the questions to be randomly assigned to the different blocks between participants.

However, the way I have it set up allows questions to repeat in different blocks because the question loop is nested below the blocks loop. I put $np.random.choice(195, 65, replace= False) in the selectedrows field of the questions loop, but I’m still seeing questions repeated across the different blocks.

Does anyone know of a better way to set up my loops in this experiment to get the behavior I want?

CompletedTask1.psyexp (120.7 KB)
FullQuestionSet.csv (15.3 KB)

Photos:
nonsocialcorrect
nonsocialwrong
Male#1Happy
Male#1Unhappy


The way I deal with this is to have one loop (in your case pointing to the sentences) and then have routines that adapt on the fly based on the iteration, or (if very different) routines that continueRoutine = False if they aren’t needed at the time.

For examples, in my prospective memory tasks the same loop is used to switch from practice, to different variations of the task (in a counterbalanced order), reusing all of the same routines.

Looking at your psyexp, I think you need to read “rulestest.csv” into separate arrays (as per my independent randomisation demo) and then move instructions2 into your Questionset loop. Then have your questionset loop select all rows. Delete your blocks loop. Add code to Instrctions2 so it ends if Questionset.thisN%65 != 0 and otherwise pops the rules and conditions from the lists so they don’t get repeated.