Tagged: loop warmup score
April 6, 2021 at 7:47 am #6837zclmclaParticipant
I am trying to set up a warmup trial that ends only when a minimum number of correct answer was reached. I am running my trial through a template. I first wanted to use a loop so that once all four sentences template table got displayed, the score would be assessed and if it was < 75% of correct answers, the warmup trial would be ran again.
Reading other forum posts I realized that this would be tricky to implement on PCIBEX so I thought of having a table with a lot more warm up sentences but make the warm up end only when a given score was reached. Here is my code (minus all the bits that aren’t relevant) :
newTrial("vartest",newVar("score", 0).global()) Template("warm_up.csv", row => newTrial( "variable", newKey("select","FJ").wait().log(), getKey("select") .test.pressed(row.Screen5) .success(getVar("score").set( v => v+1 ),newText("correct","Right answer!").italic().print() ) .failure(newText("false","Wrong answer!").color("red").print()) , newTimer("wait", 2000).start().wait(), getCanvas("FJ").remove(), getText("correct").remove(), getText("false").remove(), getVar("score") .test.is(1).success(newText("Yeah").print(),end()) ))
for now once I reach a score of 1 it does print the “Yeah” message (that I used as a test for my code), providing I add a .wait() obviously.So I assume that the score count and test works but it then moves on to the next sentence. I understand that the “end()” only ends the trial but when using a template each row/ test sentence is part of a single trial so I see why it does not work but I really don’t see a way to set up my warm up so that it only moves on after having reached a given score. I’d love to read your suggestions. I really don’t mind whether it checks the score after having completed 4 sentences and then re-run the warm or not or if it has a defined score threshold after which the warmup ends.
Many thanks !
CecileApril 6, 2021 at 11:50 am #6840JeremyKeymaster
One solution is to move your test at the beginning of the trial, so that you immediately end it as soon as it starts if the right conditions are met. This is what I illustrated in this post.
Also, if you want to re-run the same list of trials a given number of times, you don’t have to create duplicate entries in your table: simply reference their labels multiple times in the
Here is a project to illustrate what I said: https://farm.pcibex.net/r/txQFla/
Let me know if you have questions
JeremyApril 6, 2021 at 12:35 pm #6842zclmclaParticipant
Thank you so much, moving the test to the beginning of the trial worked. I feel silly to not have thought about this myself hahaha.
- You must be logged in to reply to this topic.