What I am trying to achieve: My goal is to provide feedback to the participants after the first 10 trials only if their accuracy is too low. If they get above 70% accuracy in the first 10 trials, then they proceed through the rest of the trial as normal. If they get less than 70% accuracy, they are told their accuracy is too low and then they are redirected to the instruction screen and they would have to repeat the entire block again from the start. Here is what my builder routine looks like:
In this case, I have a nested inner loop with my trial and fixation cross and an outer loop that contains the feedback and the instruction screen.
What I did to make it work: I created a custom code that would terminate the inner block when the accuracy was too low. Otherwise, if their accuracy is greater than 70% then the inner loops continue as normal and at the end of the block, I would like it to terminate the outer loop (so they don’t see the feedback and instruction screen again).
What went wrong: Even if they get better than 70% and continue normally through the inner loop, at the end of the block, the instruction screen and feedback screens still appear (outer loop doesn’t terminate) so I’m not sure how to make this work.
This is what my code looks like:
#begin routine (feature_trial is the name of my inner loop and trials is the name of my outer loop)
if feature_trial.thisN == 0:
number_correct = 0
‘’‘end of routine (key_resp_2.corr is the correct answer)’’’
‘’’ update the number correct: key_resp_2.corr represents correct answers’’’
if key_resp_2.corr:
number_correct = number_correct + 1
‘’‘what happens if they get less than 70%’’’
‘’’ if this is the 10th repetition, check the proportion correct.’’’
if feature_trial.thisN == 10:
if number_correct/(feature_trial.thisN + 1) < 0.70:
masg=‘Your accuracy is too low. Accuracy = ’ + str(number_correct*100/feature_trial.thisN + 1) +’%. Please press space to continue to the instruction screen’
‘’’ terminate inner loop’’’
feature_trial.finished = True
‘’’ don’t terminate outer loop’’’
trials.finshed = False
‘’‘what happens if they get greater than 70%’’’
elif number_correct/(feature_trial.thisN + 1) >= 0.70:
‘’’ continue inner loop’’’
feature_trial.finished = False
trials.finshed = True