WHAT ARE YOU TRYING TO ACHIEVE?
I want to present 2 types of text stimuli in a pseudorandomized order. The two types are “Visualizar” (presented 60 times) and “Reavaliar” (presented 30 times).
WHAT DID YOU TRY TO MAKE IT WORK?
I created blocks of 10 instructions, in which 6 are gonna be “Visualizar” and 3 are gonna be “Reavaliar”. In order to do so, i created a code component in the routine and had put this in the “Before experiment” tab:
#Pseudorandomize instructions (I created a block of 10 instructions, in which 6 are gonna be “Visualizar” and 3 are gonna be “Reavaliar”):
for blockinst in range(10):
blocklist_inst =
for idxinst in range(6):
blocklist_inst.append(Visualizar.pop())
for idx in range(3):
blocklist_inst.append(Reavaliar.pop())
shuffle(blocklist_inst)
useRows_inst.extend(blocklist_inst)
In the builder, i created a text component, and in the text box i typed “$useRows_inst”.
WHAT SPECIFICALLY WENT WRONG WHEN YOU TRIED THAT?:
When i run the experiment, the text shown is the complete list of instructions, not even randomized. What i want is that text shows one instruction per time, in the pseudorandomized order i created.
I’m not sure how your code relates to your request, or whether you want blocks of 9 instructions or 10 (since 6+3 = 9). However, is this any help?
blocklist_inst = []
for Idx in range(6)
blocklist_inst.append('Visualizar')
for Idx in range(3)
blocklist_inst.append('Reavaliar')
shuffle(blocklist_inst)
To pick one from the list you could pick:
useRows_inst = blocklist_inst.pop()
if len(blocklist_inst) ==0:
for Idx in range(6)
blocklist_inst.append('Visualizar')
for Idx in range(3)
blocklist_inst.append('Reavaliar')
shuffle(blocklist_inst)
#Define lists and shuffle:
blocklist_inst =
for idx in range(6):
blocklist_inst.append(‘Visualizar’)
for idx in range(3):
blocklist_inst.append(‘Reavaliar’)
shuffle(blocklist_inst)
#Pick one from list:
useRows_inst = blocklist_inst.pop()
if len(blocklist_inst) ==0:
for idx in range(6):
blocklist_inst.append(‘Visualizar’)
for idx in range(3):
blocklist_inst.append(‘Reavaliar’)
shuffle(blocklist_inst)
And the text box of the text component is now “$useRows_inst”.
However, now what this code is doing is to pick between “Visualizar” or “Reavaliar” and only shows this one instruction through all the 90 trials.