#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

# Mix order of blocks within each condition

edited August 2019

Dear swarm intelligence,

I am quite new to the community and to OpenSesame and Python as well. Although I have a general understanding and very basic knowledge of scripting and did not struggle too hard with the beginner's, intermediate and advanced tutorials, I do have a hard time finding a trivial solution for the following issue:

First, I want to assign subjects to three different subject groups/conditions, let's say conditions "1", "2" and "3". That worked quite well so far:

```if var.subject_nr % 3 == 0:
var.subject_group = '1'
elif var.subject_nr % 3 == 1:
var.subject_group = '2'
elif var.subject_nr % 3 == 2:
var.subject_group = '3'﻿
```

Now I want to split these groups again and mix blocks so that half of the participants of each subgroup start with block 1 (then block 2) and the other half starts with block 2 (then block 1).

The "Attentional Blink"-Tutorial implements this sort of counterbalancing for odd and even subject_parity, so that some start with the experimental condition first, and others start with the control condition.

```if var.subject_parity == 'even':
var.condition1 = 'experimental'
var.condition2 = 'control'
else:
var.condition1 = 'control'
var.condition2 = 'experimental'
```

﻿

I'm assuming (or hoping?) that technically there is a somewhat simple way to implement a similar balancing for three subject groups / conditions, but I just cannot seem to find it yet. I hope some of you can help me out here :-)

To illustrate what I tried to explain verbally:

• Dear Mr. Fugbaum,

As far as i can see, your answered it almost by yourself. Just adapt a little the second part of your script:

```if var.subject_parity == 'even':
var.order= '1'
if var.subject_parity == 'odd':
var.order= '2'
```

Just as a suggestion. I prefer to use names that have some meaning. Same for varnames as well as for values. Eg. var.PracticeGroup = 'MP' or 'PP'; var.order = 'IMA_first' or 'EXE_first'. Makes it easier for everyone to read your data. Even for oneself if you reanalyse it two years later because of reviewer commentaries ;)