Move forward/backward based on Block accuracy (n-back task)

Hi everyone,
I’m working on an adaptative n-back task for working-memory training. In this task, participants have to press the keyboard every time a letter matches the one presented n trials ago. Participants start completing a 0-back block (20 trials). If accuracy >0.90, they move forward to a 1-back block (20 trials). Again, if accuracy>0.90, then they start a 2-back block.

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 1.9.6
What are you trying to achieve?:
My problems appear when I try to move backwards. If accuracy is <0.7 in the 1-back and 2-back blocks, I’d like participants to move backwards and repeat the previous n-back block. For example, if the accuracy is 0.65 in a 2-back block, participants start a 1-back block. If in this block their accuracy is >0.9 they move forward again to a 2-back block. After 20 blocks, the task ends.

What did you try to make it work?:
I’ve tried to define nReps in several ways but I can’t figure out how to do it, how to configure the loop. For example, I define "nReps2back = 1 2in the “Begin experiment” tab, and include this code in the “Begin routine” tab:

What specifically went wrong when you tried that?:
The task starts from the beginning instead of moving backwards one n-back block.

Any help would be much appreciated.

Many thanks

I think you can have only one routine for all the n-back tasks, with a inner loop for the type of the n-back task, and an other loop for the total number of tasks to be completed. In the inner loop you can save the condition file as a variable, and with code specify after each competed task which version to do next.

Hi Pilar_FM! Im trying to develop a similar task but I amnot sure how to implement the accuracy parameter. How did you track and send back or forward the experiment based on response accuracy? would really appreciate the help!