Correct response n-back task
We are creating an experiment (n-back task) in OpenSesame in which we want to present symbols (as targets) alternated with images (as distractors). Participant has to indicate if the symbol is the same or different from the one presented twice before (2-back) by keyboard response. We have randomized the task symbols, but we are having difficulties in coding correct and incorrect responses (the answer is correct if the symbol showed at that moment matches with the one displayed twice before).
We used the following code for correct_response (var.target is the variable in the loop that contains the list of symbols):
target = var.target
for i in range(len(target)):
if target[i] != target[i-2]:
var.correct_response = 'left'
elif target[i] == target[i-2]:
var.correct_response = 'right'
raise ValueError('Invalid answer')
Unfortunately, using this code the program always recognizes as the correct response "left". Any ideas to solve this problem?
Thanks in advance for your help!