As per Corsi demo_online_Python to JS_syntax error - #4 by Becca you have a problem because you have a Python syntax error in code_matrix.
The offending line is for label, block in blocks.items():
which doesn’t translate automatically.
In the original Corsi demo this component is set to both and the JS side has:
// initial state
blkIndex = 0;
nextSwitch = blockDuration;
doingResponse = false;
currBlock = undefined;
// store blocks as a dictionary (to switch between name/object)
blocks = {};
blocks['blk1']=blk1;
blocks['blk2']=blk2;
blocks['blk3']=blk3;
blocks['blk4']=blk4;
blocks['blk5']=blk5;
// Create grid of locations with jitter
let xGrid = [-.3, 0, .3];
let yGrid = [-.3, 0, .3];
let locations = [];
for (let x in xGrid) {
for (let y in yGrid) {
locations.push([xGrid[x]+Math.random(2)*.1 -.05, yGrid[y]+Math.random(2)*.1 -.05]);
}
}
// Shuffle locations
for (let rolls in blocks) {
locations = locations.sort(function() { return 0.5 - Math.random()});
}
var counter = 0; // location index
// give blocks a new set of random locations
for (let items in blocks) {
if (blocks[items].hasOwnProperty('pos')) {
blocks[items].pos = locations[counter];
counter = counter + 1;
}
if (blocks[items].hasOwnProperty('fillColor')) {
blocks[items].fillColor = new util.Color('white');
blocks[items].lineColor = new util.Color('white');
}
}
sequence = ["blk1", "blk2", "blk3", "blk4", "blk5"];
respSequence = [];
and
psychoJS.experiment.addData("respSequence", respSequence);
in End Routine