Course site for "Experimental Psychology Lab" 2019
In today’s class you are going to adapt your Mental Rotation task in a number of steps, working towards a realization of the whole experiment.
packages.json
to include:"dependencies": {
"babe-project": "~0.1.0"
}
npm install
againbabeViews.Intro({XYZ})
, you would now have babeViews.view_generator('intro', {XYZ})
Practice is exactly like the main task, but we will use a hook to control for correctness.
after_response_enabled
hook to realize a check of correctness for the practice trialscorrect
, as part of each trial objectkey_press
view because the latter has a different response function; use instead the following function:const check_response = function(data, next) {
data.response_checked = false;
$("body").on("keydown", function(e) {
if (data.response_checked == false) {
const keyPressed = String.fromCharCode(
e.which
).toLowerCase();
if (keyPressed == data.key1 || keyPressed == data.key2) {
if (data[keyPressed] === data.correct) {
alert('Your answer is correct! Yey!');
} else {
alert('Sorry, this answer is incorrect :( The correct answer was ' + data.correct);
}
data.response_checked = true;
next();
}
}})
}
debug
mode at least twice