Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[solved] randomizing the order of 3 tasks x 2 conditions and 6 questions

edited February 2014 in OpenSesame

Hello hello,

I've designed a behavioural experiment in OpenSesame with 3 related tasks each of which has two conditions. Currently, the OpenSesame 'experiment' is organized into 3 'sequences' for the tasks and containing 2 'loops' & 'sequences' for the conditions, these conditions must occur in order. But, I would like the task order itself to vary.

  1. How do I randomize the tasks (3 'sequences' within the 'experiment')?

Additionally, I have 6 multiple choice questions, each of which should randomly follow a single condition and not be repeated.

  1. How(where) do I implement these multiple choice questions so that all are possible but only one occurs following one of my conditions as I have described them?
  2. How do I randomize the occurrence of my multiple choice questions in this format?

Any help would be greatly appreciated. Thanks for reading through my problem.

Comments

  • edited 5:38PM

    How do I randomize the tasks (3 'sequences' within the 'experiment')?

    One way is to add the your three sequences to a 'container' sequence and loop, like so:

    image

    Then you define a variable sequence_nr in container_loop and give it the values 1, 2, and 3 (so three cycles). Finally, you use this variable to run only one sequence for each cycle of container_loop, with the following run-if statements for sequence1, sequence2, and sequence3:

    [sequence_nr] = 1
    [sequence_nr] = 2
    [sequence_nr] = 3
    

    This effectively randomizes the order of container_sequence. Does that make sense?

    How(where) do I implement these multiple choice questions so that all are possible but only one occurs following one of my conditions as I have described them? How do I randomize the occurrence of my multiple choice questions in this format?

    This will require a little Python scripting. At the beginning of your experiment, define all the questions and response options that you want to present. For example:

    # NOTE: This script needs to be in the prepare phase, somewhere at the beginning of the experiment
    from random import shuffle
    # Define a list of multiple choice questions. Each question is actually a
    # tuple, consisting of the question, the first option, and the second option.
    mc_list = [
        ('Question 1', 'Option 1A', 'Option 1B'),
        ('Question 2', 'Option 2A', 'Option 2B'),
        ]
    # Randomize the list
    shuffle(mc_list)
    

    Now, just before the form_multiple_choice plug-in, get one of the questions from the list:

    # NOTE: This script should precede the form and be placed in the prepare phase.
    # Get and remove (i.e. pop) one question from the list of questions
    question, option_A, option_B = mc_list.pop()
    # Set the variables, so that they can be used in the form and are logged by
    # OpenSesame
    exp.set('_question', question)
    exp.set('_option_A', option_A)
    exp.set('_option_B', option_B)
    

    Now you can simply use the square-brackets notation to use [_question], [_option_A], and [_option_B] in your form_multiple_choice to define the question and response options.

    Cheers,
    Sebastiaan

  • edited 5:38PM

    Thanks for the help, it was very much appreciated!

Sign In or Register to comment.