(written by @skim725, edited by @sp576)
I wanted to implement a trial evaluation at the end of the SODM session, after the subject has made a choice on all trials. Moreover, I wanted to evaluate one trial from each condition. Finally, I wanted to the progression to the next lottery evaluation to wait for a key press.
The last request was the easiest to do: input/waitForKey
allows a specification of what key it should wait
for, and how long.
The function that existed in the library was phase/pickAndEvaluateTrial
. It had two main shortcomings:
- The more important shortcoming was, to quote issue #73, that the function conflated two things: the selection of block/trial to evaluate, and the evaluation itself. I had to decouple the logic.
- Even that logic wasn’t complete: pick a trial from a given block the function could do, but pick one block per condition it couldn’t.
- Other than that, the function also didn’t actually display outcomes, only color of the marble drawn. I had to extract the value instead of the color.
To get where I needed to go, I did the following things:
-
Factored out the logic from
pickAndEvaluateLottery
that did the actual lottery evaluation and place it inshowTrialEvaluation
, -
Rewrote
showTrialEvaluation
to show outcomes, not just marbles picked. -
Wrote
getOneBlockPerCondition
, which will return the indices for n blocks, such that there will be one block from each condition. -
Created the scaffolding in
SODM_pickTrials
, which: grabs a screen ID to display the lottery evaluation on, gets the four blocks fromgetOneBlockPerCondition
& one random trial from each, and evaluates them withshowTrialEvaluation
, all the while pausing until a key is pressed in between each of the four evaluations. -
Called
SODM_pickTrials
after all the blocks are run in SODM, the master task script.