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

Access response history for feedback

Hi there,

We are currently designing a simple color coordination game. 2 colored squares are located on the top-left/top-right side of the screen (let's say, red and blue). 2 players should coordinate their choices in order to click on the same colored square as many times as possible(20 trials). In this case, the first trial has a 50% chance to be correct. Except that player 1 is fictional and that the game is rigged so that the first choice of player 2 (an actual participant) will always be 'correct'. Therefore, the most logical thing to do for player 2 would be to stick to the same color as the previous trial. For each 'correct' trial (i.e., same color as the trial before), a positive feedback will appear to reinforce similar choice on further trials.

However, if player 2 doesn't stick to the same color (e.g., Player 2 chose 'red' in trial 1 which was correct and changes to 'blue' in trial 2), an error message should appear saying something like 'Wrong ! You partner clicked on RED again'

For now, I can access to the response color for the current trial:

if var.response=="OptionA":
    var.responsecolor = var.color_a
else:
    var.responsecolor = var.color_b

But I'm struggling to access the response color of the trial before. I'm assuming that this could help (osdoc.cogsci.nl/3.1/manual/python/responses/ but I'm not sure how to use it.

Also, I included this to mark the first trial as correct all the time:

trial_count = self.get("count_trial")
trial_count = trial_count + 1
    if trial_count == 1:
        var.correct = 1

I'm struggling to gather everything together, any help would be greatly appreciated !

All the best

CL

Comments

  • cletesscletess Posts: 18
    edited January 11

    EDIT:

    Perhaps creating a list might be more suitable ? For now, I came up with something like this that seems to do the job but I might miss something:

    if var.response=="OptionA":
        var.responsecolor = var.name_a
    else:
        var.responsecolor = var.name_b
    
    colorlist.append(var.responsecolor)
    
    if len(colorlist) == 1:
        var.correct = 1
    elif colorlist[-1]==colorlist[-2]:
        var.correct = 1
    else:
        var.correct = 0
    
  • sebastiaansebastiaan Posts: 2,670

    Hi,

    The responses object only stores information about responses. It's not clear to me if that's enough in your case, or if you really need information about experimental variables on the previous trial—which are not stored by the responses object.

    In any case, the responses object has several properties that give you a list of responses, response times, etc. For example, to get the last response:

    last_response = responses.response[-1]
    

    Or the second-to-last response:

    last_response = responses.response[-2]
    

    So that's easy. But if this doesn't give you the information you need, then you'll indeed have to create your own list-based system, like you're doing in your last post.

    Cheers,
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • cletesscletess Posts: 18

    That makes perfect sense, thank you ! I think that to do what I need, I'll have to stick to the home-made list system !

Sign In or Register to comment.