Constrained condition order
Shuffle trials while guaranteeing the same condition never runs more than twice in a row.
When to use it
Section titled “When to use it”Use this when trial order is randomised but long streaks of one condition would let participants adapt, as in conflict tasks where a run of congruent trials relaxes control and inflates the following incongruent costs. A plain shuffle cannot help you here, because by chance alone it regularly produces runs of four or five same-condition trials. An ordering constraint keeps the randomness while capping the streaks. If your conditions carry no sequential risk, skip the spec and shuffle plainly; if you need strict alternation rather than a cap, that is a different spec on the same column.
Trial file
Section titled “Trial file”| type | content | stimFormat | stim1 | condition1 | trialOrder | keyboard | key | button1 |
|---|---|---|---|---|---|---|---|---|
| instructions | Press H or S to match the CENTRE letter. | NEXT | ||||||
| test | word | HHHHH | congruent | 1: shuffle; maxRun 2 condition1 | h s | h | ||
| test | word | SSSSS | congruent | 1 | h s | s | ||
| test | word | HHHHH | congruent | 1 | h s | h | ||
| test | word | SSHSS | incongruent | 1 | h s | h | ||
| test | word | HHSHH | incongruent | 1 | h s | s | ||
| test | word | SSHSS | incongruent | 1 | h s | h |
type,content,stimFormat,stim1,condition1,trialOrder,keyboard,key,button1 instructions,Press H or S to match the CENTRE letter.,,,,,,,NEXT test,,word,HHHHH,congruent,1: shuffle; maxRun 2 condition1,h s,h, test,,word,SSSSS,congruent,1,h s,s, test,,word,HHHHH,congruent,1,h s,h, test,,word,SSHSS,incongruent,1,h s,h, test,,word,HHSHH,incongruent,1,h s,s, test,,word,SSHSS,incongruent,1,h s,h,
How it works
Section titled “How it works”A plain shuffle happily produces five incongruent trials in a row, which lets participants settle into a strategy. Here every flanker trial carries the run tag 1 in trialOrder, and one row’s cell spells out the program: 1: shuffle; maxRun 2 condition1. The shuffle word is what randomises the group, and the constraint narrows which shuffled orders are acceptable. Ordering specs do not drop any trials; after the shuffle, the group is reordered so that no more than 2 consecutive trials share a condition1 value. Write the spec on any one row of the group; the other rows take the bare tag 1.
The stimuli are letter strings shown with stimFormat word: participants respond to the centre letter, so key follows the centre letter while condition1 records whether the flankers agree with it. condition1 is also copied into every results row, ready for the congruency analysis.
The instructions row leaves trialOrder empty, so it keeps its position ahead of the shuffled block. If the constraint ever becomes unsatisfiable (say, far more incongruent than congruent trials), the session halts with an error page rather than running in a bad order; in preview mode the best order found is kept instead.
Variations
Section titled “Variations”- Forbid immediate repeats entirely:
1: shuffle; noRepeat condition1intrialOrderstops two trials with the samecondition1value from ever being adjacent. - Force strict alternation:
1: shuffle; alternate condition1intrialOrdermakes the conditions take turns. - Control spacing of one condition:
1: shuffle; gap 1 3 condition1intrialOrderdemands 1 to 3 other trials between repeats of a value. - Fix the opening trial: add
; first condition1 congruentintrialOrderso the block always starts on a congruent trial.