Randomly selecting one comprehension question

PennController for IBEX Forums Support Randomly selecting one comprehension question

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #7460
    marisolmuru
    Participant

    Hello!

    I’m currently designing a SPR task with a yes-no comprehension question. I’m using the template option and my sentences are divided into lists. But I also need to randomize the type of question that appears after the sentence. Therefore, I added four columns in my template with the four types of questions and I need to somehow make my script randomly choose only one of those as a text element in each trial. I’ve tried several things, but have not been able to make it work.

    Here is the demonstration link: https://farm.pcibex.net/r/MlmUPZ/

    Any help would be more than welcome.
    Marisol.

    #7467
    Jeremy
    Keymaster

    Hello Marisol,

    Here is a suggestion:

    var n_question = 1;
    Template("myTable.csv", row =>
      newTrial("experimento",
        newText("*").center().css("font.size", "x-large").print()
        ,
        newKey(" ").wait().log("all").disable()
        ,
        getText("*").remove()
        ,
        newController("DashedSentence", {s : row.Oracion}).center().print().wait().remove()
        ,
        n_question = 1+Math.floor(Math.random()*4)
        ,
        newText("q", row['Q'+n_question])
          .center()
          .print()
        ,
        newKey("pressOnArrow", "ArrowLeft", "ArrowRight").log().wait()
      )
      .log("n_question", n_question)
      .log("question", row['Q'+n_question])
    )

    Jeremy

    #7576
    marisolmuru
    Participant

    Thank you! It works 🙂

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.