Reply To: randomized set of scales on different pages

PennController for IBEX Forums Support randomized set of scales on different pages Reply To: randomized set of scales on different pages

#10696
Jeremy
Keymaster

Hi,

Assuming you are not using Template, you can list the question+scale pairs in an array and shuffle it, then successively fetch the elements from the (shuffled) array in three different trials:

// array of functions that return a question+scale pair
SCALES = [
    ()=>[
        newText("question1", "Question 1").center().print(),
        newScale("scale1", 7).before(newText("low X1")).after(newText("high X1")).log().center().print()
    ],
    ()=>[
        newText("question2", "Question 2").center().print(),
        newScale("scale2", 7).before(newText("low X2")).after(newText("high X2")).log().center().print()
    ],
    ()=>[
        newText("question3", "Question 3").center().print(),
        newScale("scale3", 7).before(newText("low X3")).after(newText("high X3")).log().center().print()
    ],
    ()=>[
        newText("question4", "Question 4").center().print(),
        newScale("scale4", 7).before(newText("low X4")).after(newText("high X4")).log().center().print()
    ],
    ()=>[
        newText("question5", "Question 5").center().print(),
        newScale("scale1", 7).before(newText("low X5")).after(newText("high X5")).log().center().print()
    ],
    ()=>[
        newText("question6", "Question 6").center().print(),
        newScale("scale6", 7).before(newText("low X6")).after(newText("high X6")).log().center().print()
    ],
    // etc.
]

// shuffle the array
fisherYates(SCALES)

newTrial( "page1",
    ...SCALES[0](), // insert the commands returned by the function in the first entry of the array
    ...SCALES[1](), // insert the commands returned by the function in the second entry of the array
    ...SCALES[2](), // etc.
    newButton("Next").center().print().wait()
)
newTrial( "page2",
    ...SCALES[3](),
    ...SCALES[4](),
    ...SCALES[5](),
    newButton("Next").center().print().wait()
)
// etc.

Jeremy