Reply To: Repeat trials until correct

PennController for IBEX Forums Support Repeat trials until correct Reply To: Repeat trials until correct

#8096
Jeremy
Keymaster

Hi,

You have different ways of doing it, but what I would do would be to test the different words in separate trials, which I would generate using Template (I would list the words in a CSV table). Then I would use a global Var element to keep track of performance and, at the end of the series of trials, I would go back to the beginning of the series if they did not get everything right. Here is what it would look like:

Sequence("pre-verb", "verb", "post-verb")

newTrial("pre-verb",
    newVar("verb-performance").global().set(true)
)
//Learning the verbs
Template("verbs.csv", row=>
  newTrial("verb",
    newText("question", "<p>What does '"+row.word+"' mean?</p>")
        .center()
        .print()
    ,
    newText("guess1", row.guess1)
        .print()
    ,
    newText("guess2", row.guess2)
        .print()
    ,
    newSelector("choice")
        .add(getText("guess1") , getText("guess2"))
        .shuffle()
        .frame("solid 2px purple")
        .wait()
        .log()
    ,
    newButton("check_response", "Continue")
        .center()
        .print()
        .wait(
            getSelector("choice")
                .test.selected( getText(row.correct) )
                .failure( 
                    getVar("verb-performance").set(false)
                    ,
                    newText("Sorry, this is not the correct answer. Please select again.").print() 
                )
        )
  )
)
newTrial("post-verb",
    getVar("verb-performance").global().test.is(true).failure( jump("pre-verb") )
)

With verbs.csv:

word,guess1,guess2,correct
dax,Lift,Turn,guess1
zep,Lift,Turn,guess2

Jeremy