{"size": 2514, "ext": "js", "max_stars_repo_path": "04_trials.js", "max_stars_repo_name": "annassommer/XPLab_MentalRotation", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "04_trials.js", "max_issues_repo_name": "annassommer/XPLab_MentalRotation", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "04_trials.js", "max_forks_repo_name": "annassommer/XPLab_MentalRotation", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 31.037037037, "max_line_length": 106, "alphanum_fraction": 0.6026252983}
// In this file you can specify the trial data for your experiment

const trial_info = {
    key_press_trials: [

    ],
    key_press_trials_main: [

    ],

};

// create an array of filenames and shuffle it for the test run
var images_test = [];
for(i = 13; i<=15; i++) {
    images_test.push({name: ''+i+'_50_same.jpg', expected: 'same', key: 'b', rotation: '50'});
    images_test.push({name: ''+i+'_50_different.jpg', expected: 'different', key: 'n', rotation: '50'});
    images_test.push({name: ''+i+'_150_same.jpg', expected: 'same', key: 'b', rotation: '150'});
    images_test.push({name: ''+i+'_150_different.jpg', expected: 'different', key: 'n', rotation: '150'});
}
images_test = shuffle(images_test);

// create an array of filenames and shuffle it for the main run
var images_main = [];
for(i = 1; i<=12; i++) {
    images_main.push({name: ''+i+'_50_same.jpg', expected: 'same', key: 'b', rotation: '50'});
    images_main.push({name: ''+i+'_50_different.jpg', expected: 'different', key: 'n', rotation: '50'});
    images_main.push({name: ''+i+'_150_same.jpg', expected: 'same', key: 'b', rotation: '150'});
    images_main.push({name: ''+i+'_150_different.jpg', expected: 'different', key: 'n', rotation: '150'});
}
images_main = shuffle(images_main);

// add the images to the trials
for(i = 0; i < 12; i++) {
  trial_info.key_press_trials.push({
      question: "Are the two figures the same?",
      picture: 'images/'+images_test[i].name,
      key1: 'b',
      key2: 'n',
      b: 'same',
      n: 'different',
      picturesShown: i+1,
      rotation: images_test[i].rotation,
      expected: images_test[i].expected,
      correct: images_test[i].key,
  });
}

for(i = 0; i < 48; i++) {
  trial_info.key_press_trials_main.push({
      question: "Are the two figures the same?",
      picture: 'images/'+images_main[i].name,
      key1: 'b',
      key2: 'n',
      b: 'same',
      n: 'different',
      picturesShown: i+1,
      rotation: images_main[i].rotation,
      expected: images_main[i].expected,
      correct: images_main[i].key,
  });
}

// shuffle an array
function shuffle(arra1) {
    var ctr = arra1.length, temp, index;

    // While there are elements in the array
    while (ctr > 0) {
      // Pick a random index
        index = Math.floor(Math.random() * ctr);
        // Decrease ctr by 1
        ctr--;
        // And swap the last element with it
        temp = arra1[ctr];
        arra1[ctr] = arra1[index];
        arra1[index] = temp;
    }
    return arra1;
}
