Hi everyone, I am creating a task in which participants must learn associations between symbols and sounds. It is a criterion learning task consisting of 10 trials with 3 items each: the experiment ends when participants score full marks on 3 consecutive trials OR when they reach the maximum of 10 trials. I have attached a screenshot of the workflow.
I must state that I’m new to Python, and I’m sure there are more efficient ways of achieving what I want, so any advice is appreciated!
(Straight away before I get into it, I think there might be an issue with the way I’ve set up the inner and outer loops, because the first trial seems to behave differently from subsequent trials when I’m tinkering around)
How I’ve tried to do it: in a code block in ‘trial’, I have the following:
number_correct = 0
if response.corr: number_correct += 1 else: number_correct = 0
number_correct will increase by 1 if the answer is correct. Otherwise, it will go back to 0.
That’s fine, and
number_correct is displayed in ‘score’ after each repeat so I can keep an eye on it. However, the problem is that
number_correct also needs to go back down to zero if a participant doesn’t get full marks in a trial (in other words, if they score 1, I don’t want that 1 to be carried over to the next trial).
I’ve tried to do this below, in End Routine (but as hinted at above, it doesn’t seem to work for the first trial):
if innerLoop.thisN == 2 & number_correct < 2: number_correct = 0 else: number_correct = number_correct
I.e. if the score in the 3rd item of a trial (
innerLoop.thisN == 2) is less than full marks (
number_correct < 2), then the score reverts to zero.
That also seems to work.
Now the final piece of code, in End Routine:
if number_correct >= 8: outerLoop.finished = True else: outerLoop.finished = False
The problem: the experiment finishes after 3 trials, regardless of the value of
I have tried many different things and searched on this forum, but I have hit a brick wall. Any help sorely appreciated.