Skip to content

Instantly share code, notes, and snippets.

@kishiyamat
Last active December 14, 2023 13:07
Show Gist options
  • Save kishiyamat/8fd07183e9a96ca4d989c7c4317b1ebc to your computer and use it in GitHub Desktop.
Save kishiyamat/8fd07183e9a96ca4d989c7c4317b1ebc to your computer and use it in GitHub Desktop.
PennController.ResetPrefix(null); // Shorten command names (keep this line here))
// DebugOff() // Uncomment this line only when you are 100% done designing your experiment
// NOTE: Empty project からではなく Self-Paced Reading を選択してから作業する
// これは PennController.js が機能しないため。もしEmptyから作成したい場合、以下をDLしてULする。
// https://github.com/PennController/penncontroller/blob/master/releases/2.0/PennController.js
// First show instructions, then experiment trials, send results and show end screen
Sequence("instructions", randomize("experiment"), SendResults(), "end")
// This is run at the beginning of each trial
// Declare a global Var element "ID" in which we will store the participant's ID
Header(newVar("ID").global())
.log("id", getVar("ID")) // Add the ID to all trials' results lines
// Instructions
newTrial("instructions",
// Automatically print all Text elements, centered (これは大事)
defaultText.center().print(),
// 表示させる内容
newText("ご協力ありがとうございます!"+"<br>"+
"この調査は、日本語母語話者に文を読んでいただき、それぞれの最後に文の内容を問う質問に答えます."+"<br>"+
"各文ではスペースキーを押して次の単語を読んでもらいます。"+"<br>"+
"学籍番号を記入し、問題なければ実験を開始してください。"),
// Save ID -> Validate -> Store
newTextInput("inputID", "").center().print(),
// Only validate a click on Start when inputID has been filled
newButton("Start").center().print().wait(getTextInput("inputID").testNot.text("")),
// Store the text from inputID into the Var element in global scope
getVar("ID").set(getTextInput("inputID"))
)
Template("items.csv", row =>
newTrial("experiment",
newController("DashedSentence",{s : row.sentence})
.css("font-size", "25px").print("center at 50%", "middle at 37.5%").log().wait().remove(),
newController("Question",
{q: row.question,
as: [["F", "F はい"], ["J", "J いいえ"]],
showNumbers: false
})
.css("font-size", "25px").print("center at 50%", "middle at 37.5%").log().wait()
)
.log("group", row.group)
.log("item", row.item)
.log("question", row.question)
.log("answer", row.answer)
.log("type", row.type)
.log("cond_a", row.cond_a)
.log("cond_b", row.cond_b)
)
// Final screen
newTrial("end",
newText("ご参加ありがとうございました!").center().print(),
// This link a placeholder: replace it with a URL provided by your participant-pooling platform
newText("<p><a href='https://www.pcibex.net/' target='_blank'>" +
"Click here to validate your submission</a></p>").center().print(),
// Trick: stay on this trial forever (until tab is closed)
newButton().wait()
)
.setOption("countsForProgressBar",false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment