By Lucie1043 - 5/30/2016
Hi everyone,
I am programming an experiment in which participants have to solve different problems. If they give the right answer to a problem on their first trial, they earn 100 points. If they fail to give the right answer, they can try again. However, it results in a deduction of a random ≤ 10% of the 100 total points available. Let's note that, for each problem, there are five trials available. Could you please help me to program the response cost?
Thanks a lot! Lucie
|
By Dave - 5/31/2016
The basic mechanics go like this:
<values> / points_available = 100 / problem_number = 1 / numberoftries = 0 / score = 0 </values>
<block myblock> / trials = [1-4 = selectproblem] </block>
<trial selectproblem> / ontrialbegin = [values.points_available = 100; values.numberoftries = 0; values.problem_number = list.problemitems.nextindex; ] / trialduration = 0 / recorddata = false / branch = [trial.problemtrial] </trial>
<trial problemtrial> / ontrialbegin = [values.numberoftries += 1] / ontrialbegin = [if (values.numberoftries > 1) values.points_available -= list.subtractpoints.nextindex; ] / ontrialend = [if (trial.problemtrial.correct) values.score += values.points_available; ] / stimulusframes = [1=problem, points, correctanswer, wronganswer] / inputdevice = mouse / validresponse = (correctanswer, wronganswer) / correctresponse = (correctanswer) / branch = [if (values.numberoftries < 5 && trial.problemtrial.error) trial.problemtrial] </trial>
<list problemitems> / poolsize = 4 / replace = false </list>
<list subtractpoints> / poolsize = 10 / replace = true </list>
<text problem> / items = ("Problem A", "Problem B", "Problem C", "Problem D") / select = values.problem_number </text>
<text points> / items = ("This is try #<%values.numberoftries%>. You can win <%values.points_available%> points. You have won <%values.score%> points so far.") / position = (50%, 15%) </text>
<text correctanswer> / items = ("Correct Answer to Problem A", "Correct Answer to Problem B", "Correct Answer to Problem C", "Correct Answer to Problem D") / select = values.problem_number / vposition = 75% / hposition = list.hpos.nextvalue </text>
<text wronganswer> / items = ("Wrong Answer to Problem A", "Wrong Answer to Problem B", "Wrong Answer to Problem C", "Wrong Answer to Problem D") / select = values.problem_number / vposition = 75% / hposition = list.hpos.nextvalue </text>
<list hpos> / items = (35%, 65%) / selectionrate = always </list>
|
By Lucie1043 - 5/31/2016
It is working great. Thank you!
|
|