Millisecond Forums

Problems with conditional branching

https://forums.millisecond.com/Topic21789.aspx

By John Smith - 6/6/2017

I am having trouble with conditional branching in my experiment.

I want it so that there is training to criterion on a particular block, i.e. the block keeps running until a criterion is met (32/36 trials correct) with a maximum of say 6 blocks.

This is the syntax I’ve been using but it just doesn’t seem to work (the block keeps running in a loop, rather than skipping ahead when the number after the ‘>’ is reached - in this case '1' but the number doesn't seem to make a difference):


https://www.millisecond.com/forums/Uploads/Images/048d9ca5-6d71-4779-9e6d-9b27.jpg

This is what I am copying from the help manual, but it doesn’t work:


Any advice on how to get this working would be greatly appreciated.  I'm guessing it isn't too complicated, I must just be missing something.
By Dave - 6/7/2017

John Smith - Wednesday, June 7, 2017
I am having trouble with conditional branching in my experiment.

I want it so that there is training to criterion on a particular block, i.e. the block keeps running until a criterion is met (32/36 trials correct) with a maximum of say 6 blocks.

This is the syntax I’ve been using but it just doesn’t seem to work (the block keeps running in a loop, rather than skipping ahead when the number after the ‘>’ is reached - in this case '1' but the number doesn't seem to make a difference):


https://www.millisecond.com/forums/Uploads/Images/048d9ca5-6d71-4779-9e6d-9b27.jpg

This is what I am copying from the help manual, but it doesn’t work:


Any advice on how to get this working would be greatly appreciated.  I'm guessing it isn't too complicated, I must just be missing something.

Something like this should work:

<block training>
/ postinstructions = (summary)
/ trials = [1-36=noreplace(a,b)]
/ branch = [
    if (block.training.correctcount < 32 && block.training.totalcount < 5)
    block.training]
</block>

<block end>
/ preinstructions = (endoftraining)
</block>

<expt>
/ blocks = [1=training; 2=end]
</expt>

<trial a>
/ stimulusframes = [1=a, debug]
/ validresponse = ("a", "b")
/ correctresponse = ("a")
</trial>

<trial b>
/ stimulusframes = [1=b, debug]
/ validresponse = ("a", "b")
/ correctresponse = ("b")
</trial>

<text a>
/ items = ("correct response is A")
</text>

<text b>
/ items = ("correct response is B")
</text>

<text debug>
/ items = ("n correct: <%block.training.correctcount%> | training blocks completed: <%block.training.totalcount%>")
/ position = (50%, 10%)
/ size = (70%, 5%)
/ erase = false
</text>

<page summary>
^training block #<%block.training.totalcount%> complete.
^n correct in this block: <%block.training.correctcount%>
</page>

<page endoftraining>
^the training part is now over
</page>