Howdy, Stranger!

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

Supported by

How to repeat stimuli in a loop until n correct responses are given

edited December 2024 in OpenSesame

I have built a loop with 24 sounds that play at random, with correct key responses of either "1" or "2". I would like the trials to run until a particular number of correct responses are given (for my purposes, 8), after which the experiment moves on. If this takes longer than 24 trials, I would like the loop to start over (with new randomization). I also, however, want an upper ceiling to this process -- if a participant hasn't given 8 consecutive correct responses after 3 repetitions of the loop, the experiment moves on.

The procedure for this may be similar to that proposed here (https://forum.cogsci.nl/discussion/535/solved-how-to-repeat-a-particular-trial-until-correct-before-moving-on-to-next-trial), except that I want the experiment to move on after a set number of correct responses (8), not until each trial is answered correctly (once) in turn. Please let me know what steps I might take, and if I can clarify anything.

Comments

  • Hi @JKellogg,

    This can be achieved using nested loops, break if conditions and some code.

    Level 1 loop with a single row, a high number of cycles and a break if condition.

    Level 2 loop with the 24 trials with a break if condition (that would be met if 8 correct responses have been given).

    You'd have to use code to cound the number of iteration of the Level 1 loop and set the break if condition of that loop such that it breaks if the number of iterations is greater than 3.

    You'd have to use code to count the number of correct responses in the Level 2 loop (which needs to be set to 0 right before that Level 2 loop starts) and set the break if condition of that loop so that it breaks if the number of correct responses is 8.

    Hope this helps,

    Fabrice.

    Buy Me A Coffee

  • Hi @Fab, thank you for these instructions. I've decided to approach this in a more simple way, by having participants repeat the same block of word identifications until they reach 75% accuracy. I have attached a sample to show what I'm trying to do.

    I have tried to use an inline script to say an "acc" variable is "True" if [acc] is greater than or equal to 75, and I have added a "Break if acc == True" condition to the loop. I'm getting the following error, however, relating to the syntax in the inline script:

    TypeError: '>=' not supported between instances of 'list' and 'int'

    Is there a way to "access" the [acc] score that is visible in the Feedback item and define a variable as "True" if accuracy is greater than or equal to 75%? And once that's been done, is the "Break if" condition I've included the right way to go about looping the block?

  • Hi @Fab, I believe I've found a solution to this issue, by using nested loops, and running the new sequence on an "[acc] < 75" conditional!

Sign In or Register to comment.