I’m having trouble understanding how your second if statement would result in only 40 correct responses being rewarded with feedback.
My mistake, I thought you wanted responses to be rewarded only after 40 correct responses. The logic behind a counter is that it increases by 1 each time there’s a correct answer, so by only rewarding when the counter is <40
, only the first 40 correct answers are rewarded.
The ratio of correct responses will always be 3:1, with correct responses for the long line being rewarded 3x as often as correct responses for the short line. I’m not sure I fully understand the logic behind the highCorrect and lowCorrect. Again, sorry if this is a basic question I am just a little stumped!
I see, so it’s not the ratio of correct/wrong, it’s the ratio of rewarded/unrewarded? That’ll be a bit more complicated, but it looks like you’ve actually got most of it! random() > 0.75
and random() > 0.25
should give you a 3:1 ratio of rewards. One problem I can see immediately is here:
if m_v.corr == 1 and random() > .6:
Reward == 1
else:
Reward == 0
The operator ==
doesn’t set a value, it just compares it. So what you’re saying isn’t “set Reward
to equal 1”, you’re saying “does Reward
equal one?”. What you need is Reward = 1
and Reward = 0
, with just one equals sign. This is most likely why the reward isn’t appearing. Also, as you’re comparing to random()
twice, you may be decreasing the likelihood - if you already have a condition for setting Reward
at a 3:1 ratio, then so long as Reward == 1
is in your if
statement you don’t need to then do an additional comparison against random()
. You could simplify your is statements like so:
if Reward == 1:
if (m_v.keys == 'v' and MV == 'v') or (m_v.keys == 'm' and MV == 'm'):
msg = 'Correct!! You won 20 cents.'
else:
msg = ''
else:
msg = ''
So: If Reward
is 1, check whether they were correct. If they were correct, reward them, if not, don’t. If Reward
is not 1, don’t reward them.
To limit this to 40 rewards, you just need to create a counter at the beginning of the experiment, let’s call it rewardCounter
, ad set its initial value to 0. Then, change your if
statements to look like this:
if Reward == 1 and rewardCounter < 40:
if (m_v.keys == 'v' and MV == 'v') or (m_v.keys == 'm' and MV == 'm'):
msg = 'Correct!! You won 20 cents.'
rewardCounter += 1
else:
msg = ''
else:
msg = ''
So, each time you give out a reward, you’re adding 1 to rewardCounter
, and once it exceeds 40 then no more rewards will be given.
One other concern, what do you do with msg
once defined? Is there a Text
element at the end of each routine whose content is set to $msg
?