Welcome!

Sign in with your CogSci, Facebook, Google, or Twitter account.

Or register to create a new account.

We'll use your information only for signing in to this forum.

Supported by

How create a array for collecting previous responses.

Hello everyone.
I am trying to use Opensesame to implement a pc language related assessment.
I need to stop the test when participants accuracy is below 25% in the last 8 trials (6 out of 8).

Also, the starting point of the test depends on participants age. Children start at trial 1, while adults start at trial 50. However, if adults give incorrect responses in the first 8 trials, they must go to another set (namely trial 49), going on that alternative set until they give a correct answer, then they continue as normal.

I have been trying the following:

import numpy as np
a=np.zeros((116,1))
x=0
b=0

followed by

if var.get('response') == var.get('correct_response'):
var.get('correct')=a[x]
if x>=8:
for i in rage(x-8,x):
b=a[i]+b
if b<=2:
x=-1
x=x+1

But it is not working,
I could definitely use some help. Thanks in advance.
Young Hou

Comments

  • eduardeduard Posts: 1,001

    Hi,

    To fix your code, consider this:

    var.resp_history = [] # has to be defined in the beginning of the block or the experiment. Wherever you want to start counting from
    
    var.correct =  var.response == var.correct_response
    var.resp_history.append(var.correct)
    if len(var.resp_history) > 7:
        no_correct = sum(var.resp_history[-8:])
        if no_correct < 7:
             # initialize trial 49, I don't quite know how you intend to do that
    

    Does that help?

    Eduard

Sign In or Register to comment.