Predictive Inference Task Frame
The objects for the predictive inference task
by Tricia Seow
HTML
<script src="https://rawgit.com/eu81273/jsfiddle-console/master/console.js"></script>
<div id="canvas"></div>
JavaScript
//function to calculate coordinates on the circle. the position is basically the angle.
function circleCoor(steps, centerX, centerY, radius) {
var xValues1 = [];
var yValues1 = [];
for (i = 0; i < steps; i++) {
var xValues = (centerX + radius * Math.cos(Math.PI * i / steps * 2 - Math.PI / 2));
var yValues = (centerY + radius * Math.sin(Math.PI * i / steps * 2 - Math.PI / 2));
// var xValues = (centerX + radius * Math.cos(2 * Math.PI * i / steps));
// var yValues = (centerY + radius * Math.sin(2 * Math.PI * i / steps));
var xValues1 = xValues1.concat(xValues);
var yValues1 = yValues1.concat(yValues);
}
return {
x: xValues1,
y: yValues1
};
}
/********************
* TASK-GENERAL CODE *
********************/
// Globals defined initially,
var col_white = ' #FFFFFF'; // aka rgb 255 255 255
var col_black = '#000000'; // aka rgb 000 000 000
var col_background = '#808080'; // aka rgb 128 128 128
var col_confBar = '#E5E5E5'; // aka rbg 229 229 229
var col_green = '#00FF00'; // aka rgb 0 255 0
var col_red = '#FF0000'; //aka rgb 255 0 0
var col_bucket = '#FF8000'; //aka 255 128 0
var col_money = '#FFE500'; //aka rgb 255 299 0
var col_iconFront = '#FCE300'; // 252 227 0
var col_iconBack = '#FAA500'; //250 165 0
// Open window and window data
var canvas_width = 800;
var canvas_height = 600;
var canvas_xCenter = 800 / 2;
var canvas_yCenter = 600 / 2;
//Time variables
var time_deadLine = 2500; // deadline for response
var time_ISI = 1500; // time between confirm and dot shoot
var time_RSI = 500; // time between two key presses
var time_ITI = 800; // intertrialinterval
var time_EBI = 1000; // end block interval
// Stimulus variables
var stim_std = 12;
var stim_staHazRate = 0.05;
var stim_volHazRate = 0.125;
var stim_cirDia = 500; // diameter of big circle (every degree = 4 px)
var stim_cirThickness = 15;
var stim_cirNPos = 360; // number of possible end points on circle
var stim_innerCirDia = stim_cirDia -...