/********************** 
 * Sopajsshuffle Test *
 **********************/

import { core, data, sound, util, visual, hardware } from './lib/psychojs-2022.2.0.js';
const { PsychoJS } = core;
const { TrialHandler, MultiStairHandler } = data;
const { Scheduler } = util;
//some handy aliases as in the psychopy scripts;
const { abs, sin, cos, PI: pi, sqrt } = Math;
const { round } = util;


// store info about the experiment session:
let expName = 'SopaJsShuffle';  // from the Builder filename that created this script
let expInfo = {
    'participant': '',
    'session': '001',
    'age': '',
    'gender': '',
};

// Start code blocks for 'Before Experiment'
// init psychoJS:
const psychoJS = new PsychoJS({
  debug: true
});

// open window:
psychoJS.openWindow({
  fullscr: true,
  color: new util.Color([0,0,0]),
  units: 'height',
  waitBlanking: true
});
// schedule the experiment:
psychoJS.schedule(psychoJS.gui.DlgFromDict({
  dictionary: expInfo,
  title: expName
}));

const flowScheduler = new Scheduler(psychoJS);
const dialogCancelScheduler = new Scheduler(psychoJS);
psychoJS.scheduleCondition(function() { return (psychoJS.gui.dialogComponent.button === 'OK'); }, flowScheduler, dialogCancelScheduler);

// flowScheduler gets run if the participants presses OK
flowScheduler.add(updateInfo); // add timeStamp
flowScheduler.add(experimentInit);
const trials_2LoopScheduler = new Scheduler(psychoJS);
flowScheduler.add(trials_2LoopBegin(trials_2LoopScheduler));
flowScheduler.add(trials_2LoopScheduler);
flowScheduler.add(trials_2LoopEnd);
const trialsLoopScheduler = new Scheduler(psychoJS);
flowScheduler.add(trialsLoopBegin(trialsLoopScheduler));
flowScheduler.add(trialsLoopScheduler);
flowScheduler.add(trialsLoopEnd);
flowScheduler.add(ByeByeRoutineBegin());
flowScheduler.add(ByeByeRoutineEachFrame());
flowScheduler.add(ByeByeRoutineEnd());
flowScheduler.add(quitPsychoJS, '', true);

// quit if user presses Cancel in dialog box:
dialogCancelScheduler.add(quitPsychoJS, '', false);

psychoJS.start({
  expName: expName,
  expInfo: expInfo,
  resources: [
    {'name': 'Instructions/Slide10.JPG', 'path': 'Instructions/Slide10.JPG'},
    {'name': 'Instructions/Slide8.JPG', 'path': 'Instructions/Slide8.JPG'},
    {'name': 'Instructions/Slide2.JPG', 'path': 'Instructions/Slide2.JPG'},
    {'name': 'Instructions/Slide13.JPG', 'path': 'Instructions/Slide13.JPG'},
    {'name': 'Instructions/Slide7.JPG', 'path': 'Instructions/Slide7.JPG'},
    {'name': 'Instructions/Slide3.JPG', 'path': 'Instructions/Slide3.JPG'},
    {'name': 'Instructions/Slide1.JPG', 'path': 'Instructions/Slide1.JPG'},
    {'name': 'Instructions/Slide4.JPG', 'path': 'Instructions/Slide4.JPG'},
    {'name': 'Instructions/Slide11.JPG', 'path': 'Instructions/Slide11.JPG'},
    {'name': 'Instructions/Slide5.JPG', 'path': 'Instructions/Slide5.JPG'},
    {'name': 'Instructions/Slide12.JPG', 'path': 'Instructions/Slide12.JPG'},
    {'name': 'Instructions/Slide9.JPG', 'path': 'Instructions/Slide9.JPG'},
    {'name': 'Instructions/Slide6.JPG', 'path': 'Instructions/Slide6.JPG'},
    {'name': 'Instructions/Slide14.JPG', 'path': 'Instructions/Slide14.JPG'}
  ]
});

psychoJS.experimentLogger.setLevel(core.Logger.ServerLevel.EXP);


var currentLoop;
var frameDur;
async function updateInfo() {
  currentLoop = psychoJS.experiment;  // right now there are no loops
  expInfo['date'] = util.MonotonicClock.getDateStr();  // add a simple timestamp
  expInfo['expName'] = expName;
  expInfo['psychopyVersion'] = '2022.2.0';
  expInfo['OS'] = window.navigator.platform;

  psychoJS.experiment.dataFileName = (("." + "/") + `data/${expInfo["participant"]}_${expName}_${expInfo["date"]}`);

  // store frame rate of monitor if we can measure it successfully
  expInfo['frameRate'] = psychoJS.window.getActualFrameRate();
  if (typeof expInfo['frameRate'] !== 'undefined')
    frameDur = 1.0 / Math.round(expInfo['frameRate']);
  else
    frameDur = 1.0 / 60.0; // couldn't get a reliable measure so guess

  // add info from the URL:
  util.addInfoFromUrl(expInfo);
  psychoJS.setRedirectUrls('https://docs.google.com/forms/d/e/1FAIpQLSfAlCul5jYBqk4v9qshnfPq-6QiziEsC6daEuxpY43A7_ZcFQ/viewform?usp=sf_link', '');

  return Scheduler.Event.NEXT;
}


var instructClock;
var instructionImage;
var key_resp_6;
var slideN;
var maxslideN;
var minslideN;
var resources;
var trialClock;
var image;
var key_resp;
var text;
var numimg;
var letter1;
var letter2;
var letter3;
var letter4;
var imagearray;
var distortion;
var stims;
var repeats;
var blankClock;
var text_2;
var BreakClock;
var key_resp_5;
var text_4;
var ByeByeClock;
var text_3;
var key_resp_4;
var globalClock;
var routineTimer;
async function experimentInit() {
  // Initialize components for Routine "instruct"
  instructClock = new util.Clock();
  instructionImage = new visual.ImageStim({
    win : psychoJS.window,
    name : 'instructionImage', units : 'pix', 
    image : undefined, mask : undefined,
    ori : 0.0, pos : [0, 0], size : [1600, 1067],
    color : new util.Color([1,1,1]), opacity : undefined,
    flipHoriz : false, flipVert : false,
    texRes : 128.0, interpolate : true, depth : 0.0 
  });
  key_resp_6 = new core.Keyboard({psychoJS: psychoJS, clock: new util.Clock(), waitForStart: true});
  
  // Run 'Begin Experiment' code from code_2
  slideN = 1;
  maxslideN = 14;
  minslideN = 1;
  
  resources = {
    status: PsychoJS.Status.NOT_STARTED
  };
  // Initialize components for Routine "trial"
  trialClock = new util.Clock();
  image = new visual.ImageStim({
    win : psychoJS.window,
    name : 'image', units : 'pix', 
    image : undefined, mask : undefined,
    ori : 0.0, pos : [0, 0], size : [1600, 1067],
    color : new util.Color([1,1,1]), opacity : undefined,
    flipHoriz : false, flipVert : false,
    texRes : 128.0, interpolate : true, depth : 0.0 
  });
  key_resp = new core.Keyboard({psychoJS: psychoJS, clock: new util.Clock(), waitForStart: true});
  
  text = new visual.TextStim({
    win: psychoJS.window,
    name: 'text',
    text: '1: Bad      2: Poor      3: Fair      4: Good      5: Excellent',
    font: 'Open Sans',
    units: undefined, 
    pos: [0, (- 0.46)], height: 0.04,  wrapWidth: undefined, ori: 0.0,
    languageStyle: 'LTR',
    color: new util.Color('white'),  opacity: undefined,
    depth: -2.0 
  });
  
  // Run 'Begin Experiment' code from code_3
  // function for shuffling
  function shuffle(array) {
    var copy = [], n = array.length, i;
  
    // While there remain elements to shuffle…
    while (n) {
  
      // Pick a remaining element…
      i = Math.floor(Math.random() * array.length);
  
      // If not already shuffled, move it to the new array.
      if (i in array) {
        copy.push(array[i]);
        delete array[i];
        n--;
      }
    }
  
    return copy;
  }
  
  
  // function for generating a sequence
  function range(start, end) {
            return Array(end - start + 1).fill().map((_, idx) => start + idx)
        }
              
  numimg = 32;
  letter1 = new Array(numimg / 16).fill([".jpg", "_06_03.jpg", "_07_03.jpg", "_08_03.jpg"]).flat();
  letter2 = new Array(numimg / 16).fill([".jpg", "_06_03.jpg", "_07_03.jpg", "_08_03.jpg"]).flat();
  letter3 = new Array(numimg / 16).fill([".jpg", "_06_03.jpg", "_07_03.jpg", "_08_03.jpg"]).flat();
  letter4 = new Array(numimg / 16).fill([".jpg", "_06_03.jpg", "_07_03.jpg", "_08_03.jpg"]).flat();
  
  letter1 = shuffle(letter1);
  letter2 = shuffle(letter2);
  letter3 = shuffle(letter3);
  letter4 = shuffle(letter4);
  
  // generate image array
  imagearray  = range(1, numimg)
  imagearray = shuffle(imagearray);
  
  distortion = letter1.concat(letter2).concat(letter3).concat(letter4)
  
  // merge both arrays element by element to get the final stim array
  stims = [imagearray , distortion ].reduce((a, b) => a.map((v, i) => v + b[i]))
  
  // shuffle
  stims = shuffle(stims)
  // function for shuffling
  function shuffle(array) {
    var copy = [], n = array.length, i;
  
    // While there remain elements to shuffle…
    while (n) {
  
      // Pick a remaining element…
      i = Math.floor(Math.random() * array.length);
  
      // If not already shuffled, move it to the new array.
      if (i in array) {
        copy.push(array[i]);
        delete array[i];
        n--;
      }
    }
  
    return copy;
  }
  
  
  // function for generating a sequence
  function range(start, end) {
            return Array(end - start + 1).fill().map((_, idx) => start + idx)
        }
              
  numimg = 192;
  repeats = 8
  
  letter1 = new Array(numimg / 16).fill([".jpg", "_06_03.jpg", "_07_03.jpg", "_08_03.jpg"]).flat();
  letter2 = new Array(numimg / 16).fill([".jpg", "_06_03.jpg", "_07_03.jpg", "_08_03.jpg"]).flat();
  letter3 = new Array(numimg / 16).fill([".jpg", "_06_03.jpg", "_07_03.jpg", "_08_03.jpg"]).flat();
  letter4 = new Array(numimg / 16).fill([".jpg", "_06_03.jpg", "_07_03.jpg", "_08_03.jpg"]).flat();
  
  letter1 = shuffle(letter1);
  letter2 = shuffle(letter2);
  letter3 = shuffle(letter3);
  letter4 = shuffle(letter4);
  
  // generate image array
  imagearray  = range(1, numimg)
  imagearray = shuffle(imagearray);
  
  distortion = letter1.concat(letter2).concat(letter3).concat(letter4)
  
  // merge both arrays element by element to get the final stim array
  stims = [imagearray , distortion ].reduce((a, b) => a.map((v, i) => v + b[i]))
  
  // shuffle
  stims = shuffle(stims)
  
  // Add elements to test correlation
  stims = stims.concat(stims.slice(0, repeats))
  stims = shuffle(stims)
  // Initialize components for Routine "blank"
  blankClock = new util.Clock();
  text_2 = new visual.TextStim({
    win: psychoJS.window,
    name: 'text_2',
    text: '',
    font: 'Open Sans',
    units: undefined, 
    pos: [0, 0], height: 0.1,  wrapWidth: undefined, ori: 0.0,
    languageStyle: 'LTR',
    color: new util.Color('white'),  opacity: undefined,
    depth: 0.0 
  });
  
  // Initialize components for Routine "Break"
  BreakClock = new util.Clock();
  key_resp_5 = new core.Keyboard({psychoJS: psychoJS, clock: new util.Clock(), waitForStart: true});
  
  text_4 = new visual.TextStim({
    win: psychoJS.window,
    name: 'text_4',
    text: 'Break. Rest your eyes, if necessary.\n\nPress space to continue.',
    font: 'Open Sans',
    units: undefined, 
    pos: [0, 0], height: 0.05,  wrapWidth: undefined, ori: 0.0,
    languageStyle: 'LTR',
    color: new util.Color('white'),  opacity: undefined,
    depth: -1.0 
  });
  
  // Initialize components for Routine "ByeBye"
  ByeByeClock = new util.Clock();
  text_3 = new visual.TextStim({
    win: psychoJS.window,
    name: 'text_3',
    text: 'Thank you for participating.\nPress space and wait for a confirmation that all is saved correctly.\n\nA survey should open briefly. If not, please find the link in the prolific description.\n\nAfter the survey, you will receive your completion code.',
    font: 'Open Sans',
    units: undefined, 
    pos: [0, 0], height: 0.05,  wrapWidth: undefined, ori: 0.0,
    languageStyle: 'LTR',
    color: new util.Color('white'),  opacity: undefined,
    depth: 0.0 
  });
  
  key_resp_4 = new core.Keyboard({psychoJS: psychoJS, clock: new util.Clock(), waitForStart: true});
  
  // Create some handy timers
  globalClock = new util.Clock();  // to track the time since experiment started
  routineTimer = new util.CountdownTimer();  // to track time remaining of each (non-slip) routine
  
  return Scheduler.Event.NEXT;
}


var trials_2;
function trials_2LoopBegin(trials_2LoopScheduler, snapshot) {
  return async function() {
    TrialHandler.fromSnapshot(snapshot); // update internal variables (.thisN etc) of the loop
    
    // set up handler to look after randomisation of conditions etc
    trials_2 = new TrialHandler({
      psychoJS: psychoJS,
      nReps: 500, method: TrialHandler.Method.RANDOM,
      extraInfo: expInfo, originPath: undefined,
      trialList: undefined,
      seed: undefined, name: 'trials_2'
    });
    psychoJS.experiment.addLoop(trials_2); // add the loop to the experiment
    currentLoop = trials_2;  // we're now the current loop
    
    // Schedule all the trials in the trialList:
    for (const thisTrial_2 of trials_2) {
      snapshot = trials_2.getSnapshot();
      trials_2LoopScheduler.add(importConditions(snapshot));
      trials_2LoopScheduler.add(instructRoutineBegin(snapshot));
      trials_2LoopScheduler.add(instructRoutineEachFrame());
      trials_2LoopScheduler.add(instructRoutineEnd(snapshot));
      trials_2LoopScheduler.add(trials_2LoopEndIteration(trials_2LoopScheduler, snapshot));
    }
    
    return Scheduler.Event.NEXT;
  }
}


async function trials_2LoopEnd() {
  // terminate loop
  psychoJS.experiment.removeLoop(trials_2);
  // update the current loop from the ExperimentHandler
  if (psychoJS.experiment._unfinishedLoops.length>0)
    currentLoop = psychoJS.experiment._unfinishedLoops.at(-1);
  else
    currentLoop = psychoJS.experiment;  // so we use addData from the experiment
  return Scheduler.Event.NEXT;
}


function trials_2LoopEndIteration(scheduler, snapshot) {
  // ------Prepare for next entry------
  return async function () {
    if (typeof snapshot !== 'undefined') {
      // ------Check if user ended loop early------
      if (snapshot.finished) {
        // Check for and save orphaned data
        if (psychoJS.experiment.isEntryEmpty()) {
          psychoJS.experiment.nextEntry(snapshot);
        }
        scheduler.stop();
      } else {
        psychoJS.experiment.nextEntry(snapshot);
      }
    return Scheduler.Event.NEXT;
    }
  };
}


var trials;
function trialsLoopBegin(trialsLoopScheduler, snapshot) {
  return async function() {
    TrialHandler.fromSnapshot(snapshot); // update internal variables (.thisN etc) of the loop
    
    // set up handler to look after randomisation of conditions etc
    trials = new TrialHandler({
      psychoJS: psychoJS,
      nReps: 200, method: TrialHandler.Method.RANDOM,
      extraInfo: expInfo, originPath: undefined,
      trialList: undefined,
      seed: undefined, name: 'trials'
    });
    psychoJS.experiment.addLoop(trials); // add the loop to the experiment
    currentLoop = trials;  // we're now the current loop
    
    // Schedule all the trials in the trialList:
    for (const thisTrial of trials) {
      snapshot = trials.getSnapshot();
      trialsLoopScheduler.add(importConditions(snapshot));
      trialsLoopScheduler.add(trialRoutineBegin(snapshot));
      trialsLoopScheduler.add(trialRoutineEachFrame());
      trialsLoopScheduler.add(trialRoutineEnd(snapshot));
      trialsLoopScheduler.add(blankRoutineBegin(snapshot));
      trialsLoopScheduler.add(blankRoutineEachFrame());
      trialsLoopScheduler.add(blankRoutineEnd(snapshot));
      trialsLoopScheduler.add(BreakRoutineBegin(snapshot));
      trialsLoopScheduler.add(BreakRoutineEachFrame());
      trialsLoopScheduler.add(BreakRoutineEnd(snapshot));
      trialsLoopScheduler.add(trialsLoopEndIteration(trialsLoopScheduler, snapshot));
    }
    
    return Scheduler.Event.NEXT;
  }
}


async function trialsLoopEnd() {
  // terminate loop
  psychoJS.experiment.removeLoop(trials);
  // update the current loop from the ExperimentHandler
  if (psychoJS.experiment._unfinishedLoops.length>0)
    currentLoop = psychoJS.experiment._unfinishedLoops.at(-1);
  else
    currentLoop = psychoJS.experiment;  // so we use addData from the experiment
  return Scheduler.Event.NEXT;
}


function trialsLoopEndIteration(scheduler, snapshot) {
  // ------Prepare for next entry------
  return async function () {
    if (typeof snapshot !== 'undefined') {
      // ------Check if user ended loop early------
      if (snapshot.finished) {
        // Check for and save orphaned data
        if (psychoJS.experiment.isEntryEmpty()) {
          psychoJS.experiment.nextEntry(snapshot);
        }
        scheduler.stop();
      } else {
        psychoJS.experiment.nextEntry(snapshot);
      }
    return Scheduler.Event.NEXT;
    }
  };
}


var t;
var frameN;
var continueRoutine;
var _key_resp_6_allKeys;
var instructComponents;
function instructRoutineBegin(snapshot) {
  return async function () {
    TrialHandler.fromSnapshot(snapshot); // ensure that .thisN vals are up to date
    
    //--- Prepare to start Routine 'instruct' ---
    t = 0;
    instructClock.reset(); // clock
    frameN = -1;
    continueRoutine = true; // until we're told otherwise
    // update component parameters for each repeat
    instructionImage.setImage((("Instructions/Slide" + slideN.toString()) + ".JPG"));
    key_resp_6.keys = undefined;
    key_resp_6.rt = undefined;
    _key_resp_6_allKeys = [];
    // keep track of which components have finished
    instructComponents = [];
    instructComponents.push(instructionImage);
    instructComponents.push(key_resp_6);
    instructComponents.push(resources);
    
    for (const thisComponent of instructComponents)
      if ('status' in thisComponent)
        thisComponent.status = PsychoJS.Status.NOT_STARTED;
    return Scheduler.Event.NEXT;
  }
}


function instructRoutineEachFrame() {
  return async function () {
    //--- Loop for each frame of Routine 'instruct' ---
    // get current time
    t = instructClock.getTime();
    frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
    // update/draw components on each frame
    
    // *instructionImage* updates
    if (t >= 0.0 && instructionImage.status === PsychoJS.Status.NOT_STARTED) {
      // keep track of start time/frame for later
      instructionImage.tStart = t;  // (not accounting for frame time here)
      instructionImage.frameNStart = frameN;  // exact frame index
      
      instructionImage.setAutoDraw(true);
    }

    
    // *key_resp_6* updates
    if (t >= 0.0 && key_resp_6.status === PsychoJS.Status.NOT_STARTED) {
      // keep track of start time/frame for later
      key_resp_6.tStart = t;  // (not accounting for frame time here)
      key_resp_6.frameNStart = frameN;  // exact frame index
      
      // keyboard checking is just starting
      psychoJS.window.callOnFlip(function() { key_resp_6.clock.reset(); });  // t=0 on next screen flip
      psychoJS.window.callOnFlip(function() { key_resp_6.start(); }); // start on screen flip
      psychoJS.window.callOnFlip(function() { key_resp_6.clearEvents(); });
    }

    if (key_resp_6.status === PsychoJS.Status.STARTED) {
      let theseKeys = key_resp_6.getKeys({keyList: ['left', 'right', 'space'], waitRelease: false});
      _key_resp_6_allKeys = _key_resp_6_allKeys.concat(theseKeys);
      if (_key_resp_6_allKeys.length > 0) {
        key_resp_6.keys = _key_resp_6_allKeys[_key_resp_6_allKeys.length - 1].name;  // just the last key pressed
        key_resp_6.rt = _key_resp_6_allKeys[_key_resp_6_allKeys.length - 1].rt;
        // a response ends the routine
        continueRoutine = false;
      }
    }
    
    // start downloading resources specified by component resources
    if (t >= 0 && resources.status === PsychoJS.Status.NOT_STARTED) {
      console.log('register and start downloading resources specified by component resources');
      await psychoJS.serverManager.prepareResources(['images/1.jpg', 'images/1_06_03.jpg', 'images/1_07_03.jpg', 'images/1_08_03.jpg', 'images/2.jpg', 'images/2_06_03.jpg', 'images/2_07_03.jpg', 'images/2_08_03.jpg', 'images/3.jpg', 'images/3_06_03.jpg', 'images/3_07_03.jpg', 'images/3_08_03.jpg', 'images/4.jpg', 'images/4_06_03.jpg', 'images/4_07_03.jpg', 'images/4_08_03.jpg', 'images/5.jpg', 'images/5_06_03.jpg', 'images/5_07_03.jpg', 'images/5_08_03.jpg', 'images/6.jpg', 'images/6_06_03.jpg', 'images/6_07_03.jpg', 'images/6_08_03.jpg', 'images/7.jpg', 'images/7_06_03.jpg', 'images/7_07_03.jpg', 'images/7_08_03.jpg', 'images/8.jpg', 'images/8_06_03.jpg', 'images/8_07_03.jpg', 'images/8_08_03.jpg', 'images/9.jpg', 'images/9_06_03.jpg', 'images/9_07_03.jpg', 'images/9_08_03.jpg', 'images/10.jpg', 'images/10_06_03.jpg', 'images/10_07_03.jpg', 'images/10_08_03.jpg', 'images/11.jpg', 'images/11_06_03.jpg', 'images/11_07_03.jpg', 'images/11_08_03.jpg', 'images/12.jpg', 'images/12_06_03.jpg', 'images/12_07_03.jpg', 'images/12_08_03.jpg', 'images/13.jpg', 'images/13_06_03.jpg', 'images/13_07_03.jpg', 'images/13_08_03.jpg', 'images/14.jpg', 'images/14_06_03.jpg', 'images/14_07_03.jpg', 'images/14_08_03.jpg', 'images/15.jpg', 'images/15_06_03.jpg', 'images/15_07_03.jpg', 'images/15_08_03.jpg', 'images/16.jpg', 'images/16_06_03.jpg', 'images/16_07_03.jpg', 'images/16_08_03.jpg', 'images/17.jpg', 'images/17_06_03.jpg', 'images/17_07_03.jpg', 'images/17_08_03.jpg', 'images/18.jpg', 'images/18_06_03.jpg', 'images/18_07_03.jpg', 'images/18_08_03.jpg', 'images/19.jpg', 'images/19_06_03.jpg', 'images/19_07_03.jpg', 'images/19_08_03.jpg', 'images/20.jpg', 'images/20_06_03.jpg', 'images/20_07_03.jpg', 'images/20_08_03.jpg', 'images/21.jpg', 'images/21_06_03.jpg', 'images/21_07_03.jpg', 'images/21_08_03.jpg', 'images/22.jpg', 'images/22_06_03.jpg', 'images/22_07_03.jpg', 'images/22_08_03.jpg', 'images/23.jpg', 'images/23_06_03.jpg', 'images/23_07_03.jpg', 'images/23_08_03.jpg', 'images/24.jpg', 'images/24_06_03.jpg', 'images/24_07_03.jpg', 'images/24_08_03.jpg', 'images/25.jpg', 'images/25_06_03.jpg', 'images/25_07_03.jpg', 'images/25_08_03.jpg', 'images/26.jpg', 'images/26_06_03.jpg', 'images/26_07_03.jpg', 'images/26_08_03.jpg', 'images/27.jpg', 'images/27_06_03.jpg', 'images/27_07_03.jpg', 'images/27_08_03.jpg', 'images/28.jpg', 'images/28_06_03.jpg', 'images/28_07_03.jpg', 'images/28_08_03.jpg', 'images/29.jpg', 'images/29_06_03.jpg', 'images/29_07_03.jpg', 'images/29_08_03.jpg', 'images/30.jpg', 'images/30_06_03.jpg', 'images/30_07_03.jpg', 'images/30_08_03.jpg', 'images/31.jpg', 'images/31_06_03.jpg', 'images/31_07_03.jpg', 'images/31_08_03.jpg', 'images/32.jpg', 'images/32_06_03.jpg', 'images/32_07_03.jpg', 'images/32_08_03.jpg', 'images/33.jpg', 'images/33_06_03.jpg', 'images/33_07_03.jpg', 'images/33_08_03.jpg', 'images/34.jpg', 'images/34_06_03.jpg', 'images/34_07_03.jpg', 'images/34_08_03.jpg', 'images/35.jpg', 'images/35_06_03.jpg', 'images/35_07_03.jpg', 'images/35_08_03.jpg', 'images/36.jpg', 'images/36_06_03.jpg', 'images/36_07_03.jpg', 'images/36_08_03.jpg', 'images/37.jpg', 'images/37_06_03.jpg', 'images/37_07_03.jpg', 'images/37_08_03.jpg', 'images/38.jpg', 'images/38_06_03.jpg', 'images/38_07_03.jpg', 'images/38_08_03.jpg', 'images/39.jpg', 'images/39_06_03.jpg', 'images/39_07_03.jpg', 'images/39_08_03.jpg', 'images/40.jpg', 'images/40_06_03.jpg', 'images/40_07_03.jpg', 'images/40_08_03.jpg', 'images/41.jpg', 'images/41_06_03.jpg', 'images/41_07_03.jpg', 'images/41_08_03.jpg', 'images/42.jpg', 'images/42_06_03.jpg', 'images/42_07_03.jpg', 'images/42_08_03.jpg', 'images/43.jpg', 'images/43_06_03.jpg', 'images/43_07_03.jpg', 'images/43_08_03.jpg', 'images/44.jpg', 'images/44_06_03.jpg', 'images/44_07_03.jpg', 'images/44_08_03.jpg', 'images/45.jpg', 'images/45_06_03.jpg', 'images/45_07_03.jpg', 'images/45_08_03.jpg', 'images/46.jpg', 'images/46_06_03.jpg', 'images/46_07_03.jpg', 'images/46_08_03.jpg', 'images/47.jpg', 'images/47_06_03.jpg', 'images/47_07_03.jpg', 'images/47_08_03.jpg', 'images/48.jpg', 'images/48_06_03.jpg', 'images/48_07_03.jpg', 'images/48_08_03.jpg', 'images/49.jpg', 'images/49_06_03.jpg', 'images/49_07_03.jpg', 'images/49_08_03.jpg', 'images/50.jpg', 'images/50_06_03.jpg', 'images/50_07_03.jpg', 'images/50_08_03.jpg', 'images/51.jpg', 'images/51_06_03.jpg', 'images/51_07_03.jpg', 'images/51_08_03.jpg', 'images/52.jpg', 'images/52_06_03.jpg', 'images/52_07_03.jpg', 'images/52_08_03.jpg', 'images/53.jpg', 'images/53_06_03.jpg', 'images/53_07_03.jpg', 'images/53_08_03.jpg', 'images/54.jpg', 'images/54_06_03.jpg', 'images/54_07_03.jpg', 'images/54_08_03.jpg', 'images/55.jpg', 'images/55_06_03.jpg', 'images/55_07_03.jpg', 'images/55_08_03.jpg', 'images/56.jpg', 'images/56_06_03.jpg', 'images/56_07_03.jpg', 'images/56_08_03.jpg', 'images/57.jpg', 'images/57_06_03.jpg', 'images/57_07_03.jpg', 'images/57_08_03.jpg', 'images/58.jpg', 'images/58_06_03.jpg', 'images/58_07_03.jpg', 'images/58_08_03.jpg', 'images/59.jpg', 'images/59_06_03.jpg', 'images/59_07_03.jpg', 'images/59_08_03.jpg', 'images/60.jpg', 'images/60_06_03.jpg', 'images/60_07_03.jpg', 'images/60_08_03.jpg', 'images/61.jpg', 'images/61_06_03.jpg', 'images/61_07_03.jpg', 'images/61_08_03.jpg', 'images/62.jpg', 'images/62_06_03.jpg', 'images/62_07_03.jpg', 'images/62_08_03.jpg', 'images/63.jpg', 'images/63_06_03.jpg', 'images/63_07_03.jpg', 'images/63_08_03.jpg', 'images/64.jpg', 'images/64_06_03.jpg', 'images/64_07_03.jpg', 'images/64_08_03.jpg', 'images/65.jpg', 'images/65_06_03.jpg', 'images/65_07_03.jpg', 'images/65_08_03.jpg', 'images/66.jpg', 'images/66_06_03.jpg', 'images/66_07_03.jpg', 'images/66_08_03.jpg', 'images/67.jpg', 'images/67_06_03.jpg', 'images/67_07_03.jpg', 'images/67_08_03.jpg', 'images/68.jpg', 'images/68_06_03.jpg', 'images/68_07_03.jpg', 'images/68_08_03.jpg', 'images/69.jpg', 'images/69_06_03.jpg', 'images/69_07_03.jpg', 'images/69_08_03.jpg', 'images/70.jpg', 'images/70_06_03.jpg', 'images/70_07_03.jpg', 'images/70_08_03.jpg', 'images/71.jpg', 'images/71_06_03.jpg', 'images/71_07_03.jpg', 'images/71_08_03.jpg', 'images/72.jpg', 'images/72_06_03.jpg', 'images/72_07_03.jpg', 'images/72_08_03.jpg', 'images/73.jpg', 'images/73_06_03.jpg', 'images/73_07_03.jpg', 'images/73_08_03.jpg', 'images/74.jpg', 'images/74_06_03.jpg', 'images/74_07_03.jpg', 'images/74_08_03.jpg', 'images/75.jpg', 'images/75_06_03.jpg', 'images/75_07_03.jpg', 'images/75_08_03.jpg', 'images/76.jpg', 'images/76_06_03.jpg', 'images/76_07_03.jpg', 'images/76_08_03.jpg', 'images/77.jpg', 'images/77_06_03.jpg', 'images/77_07_03.jpg', 'images/77_08_03.jpg', 'images/78.jpg', 'images/78_06_03.jpg', 'images/78_07_03.jpg', 'images/78_08_03.jpg', 'images/79.jpg', 'images/79_06_03.jpg', 'images/79_07_03.jpg', 'images/79_08_03.jpg', 'images/80.jpg', 'images/80_06_03.jpg', 'images/80_07_03.jpg', 'images/80_08_03.jpg', 'images/81.jpg', 'images/81_06_03.jpg', 'images/81_07_03.jpg', 'images/81_08_03.jpg', 'images/82.jpg', 'images/82_06_03.jpg', 'images/82_07_03.jpg', 'images/82_08_03.jpg', 'images/83.jpg', 'images/83_06_03.jpg', 'images/83_07_03.jpg', 'images/83_08_03.jpg', 'images/84.jpg', 'images/84_06_03.jpg', 'images/84_07_03.jpg', 'images/84_08_03.jpg', 'images/85.jpg', 'images/85_06_03.jpg', 'images/85_07_03.jpg', 'images/85_08_03.jpg', 'images/86.jpg', 'images/86_06_03.jpg', 'images/86_07_03.jpg', 'images/86_08_03.jpg', 'images/87.jpg', 'images/87_06_03.jpg', 'images/87_07_03.jpg', 'images/87_08_03.jpg', 'images/88.jpg', 'images/88_06_03.jpg', 'images/88_07_03.jpg', 'images/88_08_03.jpg', 'images/89.jpg', 'images/89_06_03.jpg', 'images/89_07_03.jpg', 'images/89_08_03.jpg', 'images/90.jpg', 'images/90_06_03.jpg', 'images/90_07_03.jpg', 'images/90_08_03.jpg', 'images/91.jpg', 'images/91_06_03.jpg', 'images/91_07_03.jpg', 'images/91_08_03.jpg', 'images/92.jpg', 'images/92_06_03.jpg', 'images/92_07_03.jpg', 'images/92_08_03.jpg', 'images/93.jpg', 'images/93_06_03.jpg', 'images/93_07_03.jpg', 'images/93_08_03.jpg', 'images/94.jpg', 'images/94_06_03.jpg', 'images/94_07_03.jpg', 'images/94_08_03.jpg', 'images/95.jpg', 'images/95_06_03.jpg', 'images/95_07_03.jpg', 'images/95_08_03.jpg', 'images/96.jpg', 'images/96_06_03.jpg', 'images/96_07_03.jpg', 'images/96_08_03.jpg', 'images/97.jpg', 'images/97_06_03.jpg', 'images/97_07_03.jpg', 'images/97_08_03.jpg', 'images/98.jpg', 'images/98_06_03.jpg', 'images/98_07_03.jpg', 'images/98_08_03.jpg', 'images/99.jpg', 'images/99_06_03.jpg', 'images/99_07_03.jpg', 'images/99_08_03.jpg', 'images/100.jpg', 'images/100_06_03.jpg', 'images/100_07_03.jpg', 'images/100_08_03.jpg', 'images/101.jpg', 'images/101_06_03.jpg', 'images/101_07_03.jpg', 'images/101_08_03.jpg', 'images/102.jpg', 'images/102_06_03.jpg', 'images/102_07_03.jpg', 'images/102_08_03.jpg', 'images/103.jpg', 'images/103_06_03.jpg', 'images/103_07_03.jpg', 'images/103_08_03.jpg', 'images/104.jpg', 'images/104_06_03.jpg', 'images/104_07_03.jpg', 'images/104_08_03.jpg', 'images/105.jpg', 'images/105_06_03.jpg', 'images/105_07_03.jpg', 'images/105_08_03.jpg', 'images/106.jpg', 'images/106_06_03.jpg', 'images/106_07_03.jpg', 'images/106_08_03.jpg', 'images/107.jpg', 'images/107_06_03.jpg', 'images/107_07_03.jpg', 'images/107_08_03.jpg', 'images/108.jpg', 'images/108_06_03.jpg', 'images/108_07_03.jpg', 'images/108_08_03.jpg', 'images/109.jpg', 'images/109_06_03.jpg', 'images/109_07_03.jpg', 'images/109_08_03.jpg', 'images/110.jpg', 'images/110_06_03.jpg', 'images/110_07_03.jpg', 'images/110_08_03.jpg', 'images/111.jpg', 'images/111_06_03.jpg', 'images/111_07_03.jpg', 'images/111_08_03.jpg', 'images/112.jpg', 'images/112_06_03.jpg', 'images/112_07_03.jpg', 'images/112_08_03.jpg', 'images/113.jpg', 'images/113_06_03.jpg', 'images/113_07_03.jpg', 'images/113_08_03.jpg', 'images/114.jpg', 'images/114_06_03.jpg', 'images/114_07_03.jpg', 'images/114_08_03.jpg', 'images/115.jpg', 'images/115_06_03.jpg', 'images/115_07_03.jpg', 'images/115_08_03.jpg', 'images/116.jpg', 'images/116_06_03.jpg', 'images/116_07_03.jpg', 'images/116_08_03.jpg', 'images/117.jpg', 'images/117_06_03.jpg', 'images/117_07_03.jpg', 'images/117_08_03.jpg', 'images/118.jpg', 'images/118_06_03.jpg', 'images/118_07_03.jpg', 'images/118_08_03.jpg', 'images/119.jpg', 'images/119_06_03.jpg', 'images/119_07_03.jpg', 'images/119_08_03.jpg', 'images/120.jpg', 'images/120_06_03.jpg', 'images/120_07_03.jpg', 'images/120_08_03.jpg', 'images/121.jpg', 'images/121_06_03.jpg', 'images/121_07_03.jpg', 'images/121_08_03.jpg', 'images/122.jpg', 'images/122_06_03.jpg', 'images/122_07_03.jpg', 'images/122_08_03.jpg', 'images/123.jpg', 'images/123_06_03.jpg', 'images/123_07_03.jpg', 'images/123_08_03.jpg', 'images/124.jpg', 'images/124_06_03.jpg', 'images/124_07_03.jpg', 'images/124_08_03.jpg', 'images/125.jpg', 'images/125_06_03.jpg', 'images/125_07_03.jpg', 'images/125_08_03.jpg', 'images/126.jpg', 'images/126_06_03.jpg', 'images/126_07_03.jpg', 'images/126_08_03.jpg', 'images/127.jpg', 'images/127_06_03.jpg', 'images/127_07_03.jpg', 'images/127_08_03.jpg', 'images/128.jpg', 'images/128_06_03.jpg', 'images/128_07_03.jpg', 'images/128_08_03.jpg', 'images/129.jpg', 'images/129_06_03.jpg', 'images/129_07_03.jpg', 'images/129_08_03.jpg', 'images/130.jpg', 'images/130_06_03.jpg', 'images/130_07_03.jpg', 'images/130_08_03.jpg', 'images/131.jpg', 'images/131_06_03.jpg', 'images/131_07_03.jpg', 'images/131_08_03.jpg', 'images/132.jpg', 'images/132_06_03.jpg', 'images/132_07_03.jpg', 'images/132_08_03.jpg', 'images/133.jpg', 'images/133_06_03.jpg', 'images/133_07_03.jpg', 'images/133_08_03.jpg', 'images/134.jpg', 'images/134_06_03.jpg', 'images/134_07_03.jpg', 'images/134_08_03.jpg', 'images/135.jpg', 'images/135_06_03.jpg', 'images/135_07_03.jpg', 'images/135_08_03.jpg', 'images/136.jpg', 'images/136_06_03.jpg', 'images/136_07_03.jpg', 'images/136_08_03.jpg', 'images/137.jpg', 'images/137_06_03.jpg', 'images/137_07_03.jpg', 'images/137_08_03.jpg', 'images/138.jpg', 'images/138_06_03.jpg', 'images/138_07_03.jpg', 'images/138_08_03.jpg', 'images/139.jpg', 'images/139_06_03.jpg', 'images/139_07_03.jpg', 'images/139_08_03.jpg', 'images/140.jpg', 'images/140_06_03.jpg', 'images/140_07_03.jpg', 'images/140_08_03.jpg', 'images/141.jpg', 'images/141_06_03.jpg', 'images/141_07_03.jpg', 'images/141_08_03.jpg', 'images/142.jpg', 'images/142_06_03.jpg', 'images/142_07_03.jpg', 'images/142_08_03.jpg', 'images/143.jpg', 'images/143_06_03.jpg', 'images/143_07_03.jpg', 'images/143_08_03.jpg', 'images/144.jpg', 'images/144_06_03.jpg', 'images/144_07_03.jpg', 'images/144_08_03.jpg', 'images/145.jpg', 'images/145_06_03.jpg', 'images/145_07_03.jpg', 'images/145_08_03.jpg', 'images/146.jpg', 'images/146_06_03.jpg', 'images/146_07_03.jpg', 'images/146_08_03.jpg', 'images/147.jpg', 'images/147_06_03.jpg', 'images/147_07_03.jpg', 'images/147_08_03.jpg', 'images/148.jpg', 'images/148_06_03.jpg', 'images/148_07_03.jpg', 'images/148_08_03.jpg', 'images/149.jpg', 'images/149_06_03.jpg', 'images/149_07_03.jpg', 'images/149_08_03.jpg', 'images/150.jpg', 'images/150_06_03.jpg', 'images/150_07_03.jpg', 'images/150_08_03.jpg', 'images/151.jpg', 'images/151_06_03.jpg', 'images/151_07_03.jpg', 'images/151_08_03.jpg', 'images/152.jpg', 'images/152_06_03.jpg', 'images/152_07_03.jpg', 'images/152_08_03.jpg', 'images/153.jpg', 'images/153_06_03.jpg', 'images/153_07_03.jpg', 'images/153_08_03.jpg', 'images/154.jpg', 'images/154_06_03.jpg', 'images/154_07_03.jpg', 'images/154_08_03.jpg', 'images/155.jpg', 'images/155_06_03.jpg', 'images/155_07_03.jpg', 'images/155_08_03.jpg', 'images/156.jpg', 'images/156_06_03.jpg', 'images/156_07_03.jpg', 'images/156_08_03.jpg', 'images/157.jpg', 'images/157_06_03.jpg', 'images/157_07_03.jpg', 'images/157_08_03.jpg', 'images/158.jpg', 'images/158_06_03.jpg', 'images/158_07_03.jpg', 'images/158_08_03.jpg', 'images/159.jpg', 'images/159_06_03.jpg', 'images/159_07_03.jpg', 'images/159_08_03.jpg', 'images/160.jpg', 'images/160_06_03.jpg', 'images/160_07_03.jpg', 'images/160_08_03.jpg', 'images/161.jpg', 'images/161_06_03.jpg', 'images/161_07_03.jpg', 'images/161_08_03.jpg', 'images/162.jpg', 'images/162_06_03.jpg', 'images/162_07_03.jpg', 'images/162_08_03.jpg', 'images/163.jpg', 'images/163_06_03.jpg', 'images/163_07_03.jpg', 'images/163_08_03.jpg', 'images/164.jpg', 'images/164_06_03.jpg', 'images/164_07_03.jpg', 'images/164_08_03.jpg', 'images/165.jpg', 'images/165_06_03.jpg', 'images/165_07_03.jpg', 'images/165_08_03.jpg', 'images/166.jpg', 'images/166_06_03.jpg', 'images/166_07_03.jpg', 'images/166_08_03.jpg', 'images/167.jpg', 'images/167_06_03.jpg', 'images/167_07_03.jpg', 'images/167_08_03.jpg', 'images/168.jpg', 'images/168_06_03.jpg', 'images/168_07_03.jpg', 'images/168_08_03.jpg', 'images/169.jpg', 'images/169_06_03.jpg', 'images/169_07_03.jpg', 'images/169_08_03.jpg', 'images/170.jpg', 'images/170_06_03.jpg', 'images/170_07_03.jpg', 'images/170_08_03.jpg', 'images/171.jpg', 'images/171_06_03.jpg', 'images/171_07_03.jpg', 'images/171_08_03.jpg', 'images/172.jpg', 'images/172_06_03.jpg', 'images/172_07_03.jpg', 'images/172_08_03.jpg', 'images/173.jpg', 'images/173_06_03.jpg', 'images/173_07_03.jpg', 'images/173_08_03.jpg', 'images/174.jpg', 'images/174_06_03.jpg', 'images/174_07_03.jpg', 'images/174_08_03.jpg', 'images/175.jpg', 'images/175_06_03.jpg', 'images/175_07_03.jpg', 'images/175_08_03.jpg', 'images/176.jpg', 'images/176_06_03.jpg', 'images/176_07_03.jpg', 'images/176_08_03.jpg', 'images/177.jpg', 'images/177_06_03.jpg', 'images/177_07_03.jpg', 'images/177_08_03.jpg', 'images/178.jpg', 'images/178_06_03.jpg', 'images/178_07_03.jpg', 'images/178_08_03.jpg', 'images/179.jpg', 'images/179_06_03.jpg', 'images/179_07_03.jpg', 'images/179_08_03.jpg', 'images/180.jpg', 'images/180_06_03.jpg', 'images/180_07_03.jpg', 'images/180_08_03.jpg', 'images/181.jpg', 'images/181_06_03.jpg', 'images/181_07_03.jpg', 'images/181_08_03.jpg', 'images/182.jpg', 'images/182_06_03.jpg', 'images/182_07_03.jpg', 'images/182_08_03.jpg', 'images/183.jpg', 'images/183_06_03.jpg', 'images/183_07_03.jpg', 'images/183_08_03.jpg', 'images/184.jpg', 'images/184_06_03.jpg', 'images/184_07_03.jpg', 'images/184_08_03.jpg', 'images/185.jpg', 'images/185_06_03.jpg', 'images/185_07_03.jpg', 'images/185_08_03.jpg', 'images/186.jpg', 'images/186_06_03.jpg', 'images/186_07_03.jpg', 'images/186_08_03.jpg', 'images/187.jpg', 'images/187_06_03.jpg', 'images/187_07_03.jpg', 'images/187_08_03.jpg', 'images/188.jpg', 'images/188_06_03.jpg', 'images/188_07_03.jpg', 'images/188_08_03.jpg', 'images/189.jpg', 'images/189_06_03.jpg', 'images/189_07_03.jpg', 'images/189_08_03.jpg', 'images/190.jpg', 'images/190_06_03.jpg', 'images/190_07_03.jpg', 'images/190_08_03.jpg', 'images/191.jpg', 'images/191_06_03.jpg', 'images/191_07_03.jpg', 'images/191_08_03.jpg', 'images/192.jpg', 'images/192_06_03.jpg', 'images/192_07_03.jpg', 'images/192_08_03.jpg', 'images/193.jpg', 'images/193_06_03.jpg', 'images/193_07_03.jpg', 'images/193_08_03.jpg', 'images/194.jpg', 'images/194_06_03.jpg', 'images/194_07_03.jpg', 'images/194_08_03.jpg', 'images/195.jpg', 'images/195_06_03.jpg', 'images/195_07_03.jpg', 'images/195_08_03.jpg', 'images/196.jpg', 'images/196_06_03.jpg', 'images/196_07_03.jpg', 'images/196_08_03.jpg', 'images/197.jpg', 'images/197_06_03.jpg', 'images/197_07_03.jpg', 'images/197_08_03.jpg', 'images/198.jpg', 'images/198_06_03.jpg', 'images/198_07_03.jpg', 'images/198_08_03.jpg', 'images/199.jpg', 'images/199_06_03.jpg', 'images/199_07_03.jpg', 'images/199_08_03.jpg', 'images/200.jpg', 'images/200_06_03.jpg', 'images/200_07_03.jpg', 'images/200_08_03.jpg']);
      resources.status = PsychoJS.Status.STARTED;
    }
    // check on the resources specified by component resources
    if (t >= null && resources.status === PsychoJS.Status.STARTED) {
      if (psychoJS.serverManager.getResourceStatus(['images/1.jpg', 'images/1_06_03.jpg', 'images/1_07_03.jpg', 'images/1_08_03.jpg', 'images/2.jpg', 'images/2_06_03.jpg', 'images/2_07_03.jpg', 'images/2_08_03.jpg', 'images/3.jpg', 'images/3_06_03.jpg', 'images/3_07_03.jpg', 'images/3_08_03.jpg', 'images/4.jpg', 'images/4_06_03.jpg', 'images/4_07_03.jpg', 'images/4_08_03.jpg', 'images/5.jpg', 'images/5_06_03.jpg', 'images/5_07_03.jpg', 'images/5_08_03.jpg', 'images/6.jpg', 'images/6_06_03.jpg', 'images/6_07_03.jpg', 'images/6_08_03.jpg', 'images/7.jpg', 'images/7_06_03.jpg', 'images/7_07_03.jpg', 'images/7_08_03.jpg', 'images/8.jpg', 'images/8_06_03.jpg', 'images/8_07_03.jpg', 'images/8_08_03.jpg', 'images/9.jpg', 'images/9_06_03.jpg', 'images/9_07_03.jpg', 'images/9_08_03.jpg', 'images/10.jpg', 'images/10_06_03.jpg', 'images/10_07_03.jpg', 'images/10_08_03.jpg', 'images/11.jpg', 'images/11_06_03.jpg', 'images/11_07_03.jpg', 'images/11_08_03.jpg', 'images/12.jpg', 'images/12_06_03.jpg', 'images/12_07_03.jpg', 'images/12_08_03.jpg', 'images/13.jpg', 'images/13_06_03.jpg', 'images/13_07_03.jpg', 'images/13_08_03.jpg', 'images/14.jpg', 'images/14_06_03.jpg', 'images/14_07_03.jpg', 'images/14_08_03.jpg', 'images/15.jpg', 'images/15_06_03.jpg', 'images/15_07_03.jpg', 'images/15_08_03.jpg', 'images/16.jpg', 'images/16_06_03.jpg', 'images/16_07_03.jpg', 'images/16_08_03.jpg', 'images/17.jpg', 'images/17_06_03.jpg', 'images/17_07_03.jpg', 'images/17_08_03.jpg', 'images/18.jpg', 'images/18_06_03.jpg', 'images/18_07_03.jpg', 'images/18_08_03.jpg', 'images/19.jpg', 'images/19_06_03.jpg', 'images/19_07_03.jpg', 'images/19_08_03.jpg', 'images/20.jpg', 'images/20_06_03.jpg', 'images/20_07_03.jpg', 'images/20_08_03.jpg', 'images/21.jpg', 'images/21_06_03.jpg', 'images/21_07_03.jpg', 'images/21_08_03.jpg', 'images/22.jpg', 'images/22_06_03.jpg', 'images/22_07_03.jpg', 'images/22_08_03.jpg', 'images/23.jpg', 'images/23_06_03.jpg', 'images/23_07_03.jpg', 'images/23_08_03.jpg', 'images/24.jpg', 'images/24_06_03.jpg', 'images/24_07_03.jpg', 'images/24_08_03.jpg', 'images/25.jpg', 'images/25_06_03.jpg', 'images/25_07_03.jpg', 'images/25_08_03.jpg', 'images/26.jpg', 'images/26_06_03.jpg', 'images/26_07_03.jpg', 'images/26_08_03.jpg', 'images/27.jpg', 'images/27_06_03.jpg', 'images/27_07_03.jpg', 'images/27_08_03.jpg', 'images/28.jpg', 'images/28_06_03.jpg', 'images/28_07_03.jpg', 'images/28_08_03.jpg', 'images/29.jpg', 'images/29_06_03.jpg', 'images/29_07_03.jpg', 'images/29_08_03.jpg', 'images/30.jpg', 'images/30_06_03.jpg', 'images/30_07_03.jpg', 'images/30_08_03.jpg', 'images/31.jpg', 'images/31_06_03.jpg', 'images/31_07_03.jpg', 'images/31_08_03.jpg', 'images/32.jpg', 'images/32_06_03.jpg', 'images/32_07_03.jpg', 'images/32_08_03.jpg', 'images/33.jpg', 'images/33_06_03.jpg', 'images/33_07_03.jpg', 'images/33_08_03.jpg', 'images/34.jpg', 'images/34_06_03.jpg', 'images/34_07_03.jpg', 'images/34_08_03.jpg', 'images/35.jpg', 'images/35_06_03.jpg', 'images/35_07_03.jpg', 'images/35_08_03.jpg', 'images/36.jpg', 'images/36_06_03.jpg', 'images/36_07_03.jpg', 'images/36_08_03.jpg', 'images/37.jpg', 'images/37_06_03.jpg', 'images/37_07_03.jpg', 'images/37_08_03.jpg', 'images/38.jpg', 'images/38_06_03.jpg', 'images/38_07_03.jpg', 'images/38_08_03.jpg', 'images/39.jpg', 'images/39_06_03.jpg', 'images/39_07_03.jpg', 'images/39_08_03.jpg', 'images/40.jpg', 'images/40_06_03.jpg', 'images/40_07_03.jpg', 'images/40_08_03.jpg', 'images/41.jpg', 'images/41_06_03.jpg', 'images/41_07_03.jpg', 'images/41_08_03.jpg', 'images/42.jpg', 'images/42_06_03.jpg', 'images/42_07_03.jpg', 'images/42_08_03.jpg', 'images/43.jpg', 'images/43_06_03.jpg', 'images/43_07_03.jpg', 'images/43_08_03.jpg', 'images/44.jpg', 'images/44_06_03.jpg', 'images/44_07_03.jpg', 'images/44_08_03.jpg', 'images/45.jpg', 'images/45_06_03.jpg', 'images/45_07_03.jpg', 'images/45_08_03.jpg', 'images/46.jpg', 'images/46_06_03.jpg', 'images/46_07_03.jpg', 'images/46_08_03.jpg', 'images/47.jpg', 'images/47_06_03.jpg', 'images/47_07_03.jpg', 'images/47_08_03.jpg', 'images/48.jpg', 'images/48_06_03.jpg', 'images/48_07_03.jpg', 'images/48_08_03.jpg', 'images/49.jpg', 'images/49_06_03.jpg', 'images/49_07_03.jpg', 'images/49_08_03.jpg', 'images/50.jpg', 'images/50_06_03.jpg', 'images/50_07_03.jpg', 'images/50_08_03.jpg', 'images/51.jpg', 'images/51_06_03.jpg', 'images/51_07_03.jpg', 'images/51_08_03.jpg', 'images/52.jpg', 'images/52_06_03.jpg', 'images/52_07_03.jpg', 'images/52_08_03.jpg', 'images/53.jpg', 'images/53_06_03.jpg', 'images/53_07_03.jpg', 'images/53_08_03.jpg', 'images/54.jpg', 'images/54_06_03.jpg', 'images/54_07_03.jpg', 'images/54_08_03.jpg', 'images/55.jpg', 'images/55_06_03.jpg', 'images/55_07_03.jpg', 'images/55_08_03.jpg', 'images/56.jpg', 'images/56_06_03.jpg', 'images/56_07_03.jpg', 'images/56_08_03.jpg', 'images/57.jpg', 'images/57_06_03.jpg', 'images/57_07_03.jpg', 'images/57_08_03.jpg', 'images/58.jpg', 'images/58_06_03.jpg', 'images/58_07_03.jpg', 'images/58_08_03.jpg', 'images/59.jpg', 'images/59_06_03.jpg', 'images/59_07_03.jpg', 'images/59_08_03.jpg', 'images/60.jpg', 'images/60_06_03.jpg', 'images/60_07_03.jpg', 'images/60_08_03.jpg', 'images/61.jpg', 'images/61_06_03.jpg', 'images/61_07_03.jpg', 'images/61_08_03.jpg', 'images/62.jpg', 'images/62_06_03.jpg', 'images/62_07_03.jpg', 'images/62_08_03.jpg', 'images/63.jpg', 'images/63_06_03.jpg', 'images/63_07_03.jpg', 'images/63_08_03.jpg', 'images/64.jpg', 'images/64_06_03.jpg', 'images/64_07_03.jpg', 'images/64_08_03.jpg', 'images/65.jpg', 'images/65_06_03.jpg', 'images/65_07_03.jpg', 'images/65_08_03.jpg', 'images/66.jpg', 'images/66_06_03.jpg', 'images/66_07_03.jpg', 'images/66_08_03.jpg', 'images/67.jpg', 'images/67_06_03.jpg', 'images/67_07_03.jpg', 'images/67_08_03.jpg', 'images/68.jpg', 'images/68_06_03.jpg', 'images/68_07_03.jpg', 'images/68_08_03.jpg', 'images/69.jpg', 'images/69_06_03.jpg', 'images/69_07_03.jpg', 'images/69_08_03.jpg', 'images/70.jpg', 'images/70_06_03.jpg', 'images/70_07_03.jpg', 'images/70_08_03.jpg', 'images/71.jpg', 'images/71_06_03.jpg', 'images/71_07_03.jpg', 'images/71_08_03.jpg', 'images/72.jpg', 'images/72_06_03.jpg', 'images/72_07_03.jpg', 'images/72_08_03.jpg', 'images/73.jpg', 'images/73_06_03.jpg', 'images/73_07_03.jpg', 'images/73_08_03.jpg', 'images/74.jpg', 'images/74_06_03.jpg', 'images/74_07_03.jpg', 'images/74_08_03.jpg', 'images/75.jpg', 'images/75_06_03.jpg', 'images/75_07_03.jpg', 'images/75_08_03.jpg', 'images/76.jpg', 'images/76_06_03.jpg', 'images/76_07_03.jpg', 'images/76_08_03.jpg', 'images/77.jpg', 'images/77_06_03.jpg', 'images/77_07_03.jpg', 'images/77_08_03.jpg', 'images/78.jpg', 'images/78_06_03.jpg', 'images/78_07_03.jpg', 'images/78_08_03.jpg', 'images/79.jpg', 'images/79_06_03.jpg', 'images/79_07_03.jpg', 'images/79_08_03.jpg', 'images/80.jpg', 'images/80_06_03.jpg', 'images/80_07_03.jpg', 'images/80_08_03.jpg', 'images/81.jpg', 'images/81_06_03.jpg', 'images/81_07_03.jpg', 'images/81_08_03.jpg', 'images/82.jpg', 'images/82_06_03.jpg', 'images/82_07_03.jpg', 'images/82_08_03.jpg', 'images/83.jpg', 'images/83_06_03.jpg', 'images/83_07_03.jpg', 'images/83_08_03.jpg', 'images/84.jpg', 'images/84_06_03.jpg', 'images/84_07_03.jpg', 'images/84_08_03.jpg', 'images/85.jpg', 'images/85_06_03.jpg', 'images/85_07_03.jpg', 'images/85_08_03.jpg', 'images/86.jpg', 'images/86_06_03.jpg', 'images/86_07_03.jpg', 'images/86_08_03.jpg', 'images/87.jpg', 'images/87_06_03.jpg', 'images/87_07_03.jpg', 'images/87_08_03.jpg', 'images/88.jpg', 'images/88_06_03.jpg', 'images/88_07_03.jpg', 'images/88_08_03.jpg', 'images/89.jpg', 'images/89_06_03.jpg', 'images/89_07_03.jpg', 'images/89_08_03.jpg', 'images/90.jpg', 'images/90_06_03.jpg', 'images/90_07_03.jpg', 'images/90_08_03.jpg', 'images/91.jpg', 'images/91_06_03.jpg', 'images/91_07_03.jpg', 'images/91_08_03.jpg', 'images/92.jpg', 'images/92_06_03.jpg', 'images/92_07_03.jpg', 'images/92_08_03.jpg', 'images/93.jpg', 'images/93_06_03.jpg', 'images/93_07_03.jpg', 'images/93_08_03.jpg', 'images/94.jpg', 'images/94_06_03.jpg', 'images/94_07_03.jpg', 'images/94_08_03.jpg', 'images/95.jpg', 'images/95_06_03.jpg', 'images/95_07_03.jpg', 'images/95_08_03.jpg', 'images/96.jpg', 'images/96_06_03.jpg', 'images/96_07_03.jpg', 'images/96_08_03.jpg', 'images/97.jpg', 'images/97_06_03.jpg', 'images/97_07_03.jpg', 'images/97_08_03.jpg', 'images/98.jpg', 'images/98_06_03.jpg', 'images/98_07_03.jpg', 'images/98_08_03.jpg', 'images/99.jpg', 'images/99_06_03.jpg', 'images/99_07_03.jpg', 'images/99_08_03.jpg', 'images/100.jpg', 'images/100_06_03.jpg', 'images/100_07_03.jpg', 'images/100_08_03.jpg', 'images/101.jpg', 'images/101_06_03.jpg', 'images/101_07_03.jpg', 'images/101_08_03.jpg', 'images/102.jpg', 'images/102_06_03.jpg', 'images/102_07_03.jpg', 'images/102_08_03.jpg', 'images/103.jpg', 'images/103_06_03.jpg', 'images/103_07_03.jpg', 'images/103_08_03.jpg', 'images/104.jpg', 'images/104_06_03.jpg', 'images/104_07_03.jpg', 'images/104_08_03.jpg', 'images/105.jpg', 'images/105_06_03.jpg', 'images/105_07_03.jpg', 'images/105_08_03.jpg', 'images/106.jpg', 'images/106_06_03.jpg', 'images/106_07_03.jpg', 'images/106_08_03.jpg', 'images/107.jpg', 'images/107_06_03.jpg', 'images/107_07_03.jpg', 'images/107_08_03.jpg', 'images/108.jpg', 'images/108_06_03.jpg', 'images/108_07_03.jpg', 'images/108_08_03.jpg', 'images/109.jpg', 'images/109_06_03.jpg', 'images/109_07_03.jpg', 'images/109_08_03.jpg', 'images/110.jpg', 'images/110_06_03.jpg', 'images/110_07_03.jpg', 'images/110_08_03.jpg', 'images/111.jpg', 'images/111_06_03.jpg', 'images/111_07_03.jpg', 'images/111_08_03.jpg', 'images/112.jpg', 'images/112_06_03.jpg', 'images/112_07_03.jpg', 'images/112_08_03.jpg', 'images/113.jpg', 'images/113_06_03.jpg', 'images/113_07_03.jpg', 'images/113_08_03.jpg', 'images/114.jpg', 'images/114_06_03.jpg', 'images/114_07_03.jpg', 'images/114_08_03.jpg', 'images/115.jpg', 'images/115_06_03.jpg', 'images/115_07_03.jpg', 'images/115_08_03.jpg', 'images/116.jpg', 'images/116_06_03.jpg', 'images/116_07_03.jpg', 'images/116_08_03.jpg', 'images/117.jpg', 'images/117_06_03.jpg', 'images/117_07_03.jpg', 'images/117_08_03.jpg', 'images/118.jpg', 'images/118_06_03.jpg', 'images/118_07_03.jpg', 'images/118_08_03.jpg', 'images/119.jpg', 'images/119_06_03.jpg', 'images/119_07_03.jpg', 'images/119_08_03.jpg', 'images/120.jpg', 'images/120_06_03.jpg', 'images/120_07_03.jpg', 'images/120_08_03.jpg', 'images/121.jpg', 'images/121_06_03.jpg', 'images/121_07_03.jpg', 'images/121_08_03.jpg', 'images/122.jpg', 'images/122_06_03.jpg', 'images/122_07_03.jpg', 'images/122_08_03.jpg', 'images/123.jpg', 'images/123_06_03.jpg', 'images/123_07_03.jpg', 'images/123_08_03.jpg', 'images/124.jpg', 'images/124_06_03.jpg', 'images/124_07_03.jpg', 'images/124_08_03.jpg', 'images/125.jpg', 'images/125_06_03.jpg', 'images/125_07_03.jpg', 'images/125_08_03.jpg', 'images/126.jpg', 'images/126_06_03.jpg', 'images/126_07_03.jpg', 'images/126_08_03.jpg', 'images/127.jpg', 'images/127_06_03.jpg', 'images/127_07_03.jpg', 'images/127_08_03.jpg', 'images/128.jpg', 'images/128_06_03.jpg', 'images/128_07_03.jpg', 'images/128_08_03.jpg', 'images/129.jpg', 'images/129_06_03.jpg', 'images/129_07_03.jpg', 'images/129_08_03.jpg', 'images/130.jpg', 'images/130_06_03.jpg', 'images/130_07_03.jpg', 'images/130_08_03.jpg', 'images/131.jpg', 'images/131_06_03.jpg', 'images/131_07_03.jpg', 'images/131_08_03.jpg', 'images/132.jpg', 'images/132_06_03.jpg', 'images/132_07_03.jpg', 'images/132_08_03.jpg', 'images/133.jpg', 'images/133_06_03.jpg', 'images/133_07_03.jpg', 'images/133_08_03.jpg', 'images/134.jpg', 'images/134_06_03.jpg', 'images/134_07_03.jpg', 'images/134_08_03.jpg', 'images/135.jpg', 'images/135_06_03.jpg', 'images/135_07_03.jpg', 'images/135_08_03.jpg', 'images/136.jpg', 'images/136_06_03.jpg', 'images/136_07_03.jpg', 'images/136_08_03.jpg', 'images/137.jpg', 'images/137_06_03.jpg', 'images/137_07_03.jpg', 'images/137_08_03.jpg', 'images/138.jpg', 'images/138_06_03.jpg', 'images/138_07_03.jpg', 'images/138_08_03.jpg', 'images/139.jpg', 'images/139_06_03.jpg', 'images/139_07_03.jpg', 'images/139_08_03.jpg', 'images/140.jpg', 'images/140_06_03.jpg', 'images/140_07_03.jpg', 'images/140_08_03.jpg', 'images/141.jpg', 'images/141_06_03.jpg', 'images/141_07_03.jpg', 'images/141_08_03.jpg', 'images/142.jpg', 'images/142_06_03.jpg', 'images/142_07_03.jpg', 'images/142_08_03.jpg', 'images/143.jpg', 'images/143_06_03.jpg', 'images/143_07_03.jpg', 'images/143_08_03.jpg', 'images/144.jpg', 'images/144_06_03.jpg', 'images/144_07_03.jpg', 'images/144_08_03.jpg', 'images/145.jpg', 'images/145_06_03.jpg', 'images/145_07_03.jpg', 'images/145_08_03.jpg', 'images/146.jpg', 'images/146_06_03.jpg', 'images/146_07_03.jpg', 'images/146_08_03.jpg', 'images/147.jpg', 'images/147_06_03.jpg', 'images/147_07_03.jpg', 'images/147_08_03.jpg', 'images/148.jpg', 'images/148_06_03.jpg', 'images/148_07_03.jpg', 'images/148_08_03.jpg', 'images/149.jpg', 'images/149_06_03.jpg', 'images/149_07_03.jpg', 'images/149_08_03.jpg', 'images/150.jpg', 'images/150_06_03.jpg', 'images/150_07_03.jpg', 'images/150_08_03.jpg', 'images/151.jpg', 'images/151_06_03.jpg', 'images/151_07_03.jpg', 'images/151_08_03.jpg', 'images/152.jpg', 'images/152_06_03.jpg', 'images/152_07_03.jpg', 'images/152_08_03.jpg', 'images/153.jpg', 'images/153_06_03.jpg', 'images/153_07_03.jpg', 'images/153_08_03.jpg', 'images/154.jpg', 'images/154_06_03.jpg', 'images/154_07_03.jpg', 'images/154_08_03.jpg', 'images/155.jpg', 'images/155_06_03.jpg', 'images/155_07_03.jpg', 'images/155_08_03.jpg', 'images/156.jpg', 'images/156_06_03.jpg', 'images/156_07_03.jpg', 'images/156_08_03.jpg', 'images/157.jpg', 'images/157_06_03.jpg', 'images/157_07_03.jpg', 'images/157_08_03.jpg', 'images/158.jpg', 'images/158_06_03.jpg', 'images/158_07_03.jpg', 'images/158_08_03.jpg', 'images/159.jpg', 'images/159_06_03.jpg', 'images/159_07_03.jpg', 'images/159_08_03.jpg', 'images/160.jpg', 'images/160_06_03.jpg', 'images/160_07_03.jpg', 'images/160_08_03.jpg', 'images/161.jpg', 'images/161_06_03.jpg', 'images/161_07_03.jpg', 'images/161_08_03.jpg', 'images/162.jpg', 'images/162_06_03.jpg', 'images/162_07_03.jpg', 'images/162_08_03.jpg', 'images/163.jpg', 'images/163_06_03.jpg', 'images/163_07_03.jpg', 'images/163_08_03.jpg', 'images/164.jpg', 'images/164_06_03.jpg', 'images/164_07_03.jpg', 'images/164_08_03.jpg', 'images/165.jpg', 'images/165_06_03.jpg', 'images/165_07_03.jpg', 'images/165_08_03.jpg', 'images/166.jpg', 'images/166_06_03.jpg', 'images/166_07_03.jpg', 'images/166_08_03.jpg', 'images/167.jpg', 'images/167_06_03.jpg', 'images/167_07_03.jpg', 'images/167_08_03.jpg', 'images/168.jpg', 'images/168_06_03.jpg', 'images/168_07_03.jpg', 'images/168_08_03.jpg', 'images/169.jpg', 'images/169_06_03.jpg', 'images/169_07_03.jpg', 'images/169_08_03.jpg', 'images/170.jpg', 'images/170_06_03.jpg', 'images/170_07_03.jpg', 'images/170_08_03.jpg', 'images/171.jpg', 'images/171_06_03.jpg', 'images/171_07_03.jpg', 'images/171_08_03.jpg', 'images/172.jpg', 'images/172_06_03.jpg', 'images/172_07_03.jpg', 'images/172_08_03.jpg', 'images/173.jpg', 'images/173_06_03.jpg', 'images/173_07_03.jpg', 'images/173_08_03.jpg', 'images/174.jpg', 'images/174_06_03.jpg', 'images/174_07_03.jpg', 'images/174_08_03.jpg', 'images/175.jpg', 'images/175_06_03.jpg', 'images/175_07_03.jpg', 'images/175_08_03.jpg', 'images/176.jpg', 'images/176_06_03.jpg', 'images/176_07_03.jpg', 'images/176_08_03.jpg', 'images/177.jpg', 'images/177_06_03.jpg', 'images/177_07_03.jpg', 'images/177_08_03.jpg', 'images/178.jpg', 'images/178_06_03.jpg', 'images/178_07_03.jpg', 'images/178_08_03.jpg', 'images/179.jpg', 'images/179_06_03.jpg', 'images/179_07_03.jpg', 'images/179_08_03.jpg', 'images/180.jpg', 'images/180_06_03.jpg', 'images/180_07_03.jpg', 'images/180_08_03.jpg', 'images/181.jpg', 'images/181_06_03.jpg', 'images/181_07_03.jpg', 'images/181_08_03.jpg', 'images/182.jpg', 'images/182_06_03.jpg', 'images/182_07_03.jpg', 'images/182_08_03.jpg', 'images/183.jpg', 'images/183_06_03.jpg', 'images/183_07_03.jpg', 'images/183_08_03.jpg', 'images/184.jpg', 'images/184_06_03.jpg', 'images/184_07_03.jpg', 'images/184_08_03.jpg', 'images/185.jpg', 'images/185_06_03.jpg', 'images/185_07_03.jpg', 'images/185_08_03.jpg', 'images/186.jpg', 'images/186_06_03.jpg', 'images/186_07_03.jpg', 'images/186_08_03.jpg', 'images/187.jpg', 'images/187_06_03.jpg', 'images/187_07_03.jpg', 'images/187_08_03.jpg', 'images/188.jpg', 'images/188_06_03.jpg', 'images/188_07_03.jpg', 'images/188_08_03.jpg', 'images/189.jpg', 'images/189_06_03.jpg', 'images/189_07_03.jpg', 'images/189_08_03.jpg', 'images/190.jpg', 'images/190_06_03.jpg', 'images/190_07_03.jpg', 'images/190_08_03.jpg', 'images/191.jpg', 'images/191_06_03.jpg', 'images/191_07_03.jpg', 'images/191_08_03.jpg', 'images/192.jpg', 'images/192_06_03.jpg', 'images/192_07_03.jpg', 'images/192_08_03.jpg', 'images/193.jpg', 'images/193_06_03.jpg', 'images/193_07_03.jpg', 'images/193_08_03.jpg', 'images/194.jpg', 'images/194_06_03.jpg', 'images/194_07_03.jpg', 'images/194_08_03.jpg', 'images/195.jpg', 'images/195_06_03.jpg', 'images/195_07_03.jpg', 'images/195_08_03.jpg', 'images/196.jpg', 'images/196_06_03.jpg', 'images/196_07_03.jpg', 'images/196_08_03.jpg', 'images/197.jpg', 'images/197_06_03.jpg', 'images/197_07_03.jpg', 'images/197_08_03.jpg', 'images/198.jpg', 'images/198_06_03.jpg', 'images/198_07_03.jpg', 'images/198_08_03.jpg', 'images/199.jpg', 'images/199_06_03.jpg', 'images/199_07_03.jpg', 'images/199_08_03.jpg', 'images/200.jpg', 'images/200_06_03.jpg', 'images/200_07_03.jpg', 'images/200_08_03.jpg']) === core.ServerManager.ResourceStatus.DOWNLOADED) {
        console.log('finished downloading resources specified by component resources');
        resources.status = PsychoJS.Status.FINISHED;
      } else {
        console.log('resource specified in resources took longer than expected to download');
      }
    }
    // check for quit (typically the Esc key)
    if (psychoJS.experiment.experimentEnded || psychoJS.eventManager.getKeys({keyList:['escape']}).length > 0) {
      return quitPsychoJS('The [Escape] key was pressed. Goodbye!', false);
    }
    
    // check if the Routine should terminate
    if (!continueRoutine) {  // a component has requested a forced-end of Routine
      return Scheduler.Event.NEXT;
    }
    
    continueRoutine = false;  // reverts to True if at least one component still running
    for (const thisComponent of instructComponents)
      if ('status' in thisComponent && thisComponent.status !== PsychoJS.Status.FINISHED) {
        continueRoutine = true;
        break;
      }
    
    // refresh the screen if continuing
    if (continueRoutine) {
      return Scheduler.Event.FLIP_REPEAT;
    } else {
      return Scheduler.Event.NEXT;
    }
  };
}


function instructRoutineEnd(snapshot) {
  return async function () {
    //--- Ending Routine 'instruct' ---
    for (const thisComponent of instructComponents) {
      if (typeof thisComponent.setAutoDraw === 'function') {
        thisComponent.setAutoDraw(false);
      }
    }
    key_resp_6.stop();
    // Run 'End Routine' code from code_2
    if ((key_resp_6.keys === "left")) {
        slideN -= 1;
    } else {
        if ((key_resp_6.keys === "right")) {
            slideN += 1;
        } else {
            if ((key_resp_6.keys === "space")) {
                if ((slideN === maxslideN)) {
                    trials_2.finished = true;
                }
            }
        }
    }
    if ((slideN > maxslideN)) {
        slideN = maxslideN;
    }
    if ((slideN < minslideN)) {
        slideN = minslideN;
    }
    
    // the Routine "instruct" was not non-slip safe, so reset the non-slip timer
    routineTimer.reset();
    
    // Routines running outside a loop should always advance the datafile row
    if (currentLoop === psychoJS.experiment) {
      psychoJS.experiment.nextEntry(snapshot);
    }
    return Scheduler.Event.NEXT;
  }
}


var _key_resp_allKeys;
var trialComponents;
function trialRoutineBegin(snapshot) {
  return async function () {
    TrialHandler.fromSnapshot(snapshot); // ensure that .thisN vals are up to date
    
    //--- Prepare to start Routine 'trial' ---
    t = 0;
    trialClock.reset(); // clock
    frameN = -1;
    continueRoutine = true; // until we're told otherwise
    // update component parameters for each repeat
    image.setImage(("images/" + stims[trials.thisN].toString()));
    key_resp.keys = undefined;
    key_resp.rt = undefined;
    _key_resp_allKeys = [];
    // keep track of which components have finished
    trialComponents = [];
    trialComponents.push(image);
    trialComponents.push(key_resp);
    trialComponents.push(text);
    
    for (const thisComponent of trialComponents)
      if ('status' in thisComponent)
        thisComponent.status = PsychoJS.Status.NOT_STARTED;
    return Scheduler.Event.NEXT;
  }
}


function trialRoutineEachFrame() {
  return async function () {
    //--- Loop for each frame of Routine 'trial' ---
    // get current time
    t = trialClock.getTime();
    frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
    // update/draw components on each frame
    
    // *image* updates
    if (t >= 0 && image.status === PsychoJS.Status.NOT_STARTED) {
      // keep track of start time/frame for later
      image.tStart = t;  // (not accounting for frame time here)
      image.frameNStart = frameN;  // exact frame index
      
      image.setAutoDraw(true);
    }

    
    // *key_resp* updates
    if (t >= 0.2 && key_resp.status === PsychoJS.Status.NOT_STARTED) {
      // keep track of start time/frame for later
      key_resp.tStart = t;  // (not accounting for frame time here)
      key_resp.frameNStart = frameN;  // exact frame index
      
      // keyboard checking is just starting
      psychoJS.window.callOnFlip(function() { key_resp.clock.reset(); });  // t=0 on next screen flip
      psychoJS.window.callOnFlip(function() { key_resp.start(); }); // start on screen flip
      psychoJS.window.callOnFlip(function() { key_resp.clearEvents(); });
    }

    if (key_resp.status === PsychoJS.Status.STARTED) {
      let theseKeys = key_resp.getKeys({keyList: ['1', '2', '3', '4', '5'], waitRelease: false});
      _key_resp_allKeys = _key_resp_allKeys.concat(theseKeys);
      if (_key_resp_allKeys.length > 0) {
        key_resp.keys = _key_resp_allKeys[_key_resp_allKeys.length - 1].name;  // just the last key pressed
        key_resp.rt = _key_resp_allKeys[_key_resp_allKeys.length - 1].rt;
        // a response ends the routine
        continueRoutine = false;
      }
    }
    
    
    // *text* updates
    if (t >= 0.2 && text.status === PsychoJS.Status.NOT_STARTED) {
      // keep track of start time/frame for later
      text.tStart = t;  // (not accounting for frame time here)
      text.frameNStart = frameN;  // exact frame index
      
      text.setAutoDraw(true);
    }

    // check for quit (typically the Esc key)
    if (psychoJS.experiment.experimentEnded || psychoJS.eventManager.getKeys({keyList:['escape']}).length > 0) {
      return quitPsychoJS('The [Escape] key was pressed. Goodbye!', false);
    }
    
    // check if the Routine should terminate
    if (!continueRoutine) {  // a component has requested a forced-end of Routine
      return Scheduler.Event.NEXT;
    }
    
    continueRoutine = false;  // reverts to True if at least one component still running
    for (const thisComponent of trialComponents)
      if ('status' in thisComponent && thisComponent.status !== PsychoJS.Status.FINISHED) {
        continueRoutine = true;
        break;
      }
    
    // refresh the screen if continuing
    if (continueRoutine) {
      return Scheduler.Event.FLIP_REPEAT;
    } else {
      return Scheduler.Event.NEXT;
    }
  };
}


function trialRoutineEnd(snapshot) {
  return async function () {
    //--- Ending Routine 'trial' ---
    for (const thisComponent of trialComponents) {
      if (typeof thisComponent.setAutoDraw === 'function') {
        thisComponent.setAutoDraw(false);
      }
    }
    // update the trial handler
    if (currentLoop instanceof MultiStairHandler) {
      currentLoop.addResponse(key_resp.corr, level);
    }
    psychoJS.experiment.addData('key_resp.keys', key_resp.keys);
    if (typeof key_resp.keys !== 'undefined') {  // we had a response
        psychoJS.experiment.addData('key_resp.rt', key_resp.rt);
        routineTimer.reset();
        }
    
    key_resp.stop();
    // Run 'End Routine' code from code_save
    psychoJS.experiment.addData("imageshown", stims[trials.thisN].toString());
    
    // the Routine "trial" was not non-slip safe, so reset the non-slip timer
    routineTimer.reset();
    
    // Routines running outside a loop should always advance the datafile row
    if (currentLoop === psychoJS.experiment) {
      psychoJS.experiment.nextEntry(snapshot);
    }
    return Scheduler.Event.NEXT;
  }
}


var blankComponents;
function blankRoutineBegin(snapshot) {
  return async function () {
    TrialHandler.fromSnapshot(snapshot); // ensure that .thisN vals are up to date
    
    //--- Prepare to start Routine 'blank' ---
    t = 0;
    blankClock.reset(); // clock
    frameN = -1;
    continueRoutine = true; // until we're told otherwise
    routineTimer.add(0.200000);
    // update component parameters for each repeat
    // keep track of which components have finished
    blankComponents = [];
    blankComponents.push(text_2);
    
    for (const thisComponent of blankComponents)
      if ('status' in thisComponent)
        thisComponent.status = PsychoJS.Status.NOT_STARTED;
    return Scheduler.Event.NEXT;
  }
}


var frameRemains;
function blankRoutineEachFrame() {
  return async function () {
    //--- Loop for each frame of Routine 'blank' ---
    // get current time
    t = blankClock.getTime();
    frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
    // update/draw components on each frame
    
    // *text_2* updates
    if (t >= 0.0 && text_2.status === PsychoJS.Status.NOT_STARTED) {
      // keep track of start time/frame for later
      text_2.tStart = t;  // (not accounting for frame time here)
      text_2.frameNStart = frameN;  // exact frame index
      
      text_2.setAutoDraw(true);
    }

    frameRemains = 0.0 + 0.2 - psychoJS.window.monitorFramePeriod * 0.75;  // most of one frame period left
    if (text_2.status === PsychoJS.Status.STARTED && t >= frameRemains) {
      text_2.setAutoDraw(false);
    }
    // check for quit (typically the Esc key)
    if (psychoJS.experiment.experimentEnded || psychoJS.eventManager.getKeys({keyList:['escape']}).length > 0) {
      return quitPsychoJS('The [Escape] key was pressed. Goodbye!', false);
    }
    
    // check if the Routine should terminate
    if (!continueRoutine) {  // a component has requested a forced-end of Routine
      return Scheduler.Event.NEXT;
    }
    
    continueRoutine = false;  // reverts to True if at least one component still running
    for (const thisComponent of blankComponents)
      if ('status' in thisComponent && thisComponent.status !== PsychoJS.Status.FINISHED) {
        continueRoutine = true;
        break;
      }
    
    // refresh the screen if continuing
    if (continueRoutine && routineTimer.getTime() > 0) {
      return Scheduler.Event.FLIP_REPEAT;
    } else {
      return Scheduler.Event.NEXT;
    }
  };
}


function blankRoutineEnd(snapshot) {
  return async function () {
    //--- Ending Routine 'blank' ---
    for (const thisComponent of blankComponents) {
      if (typeof thisComponent.setAutoDraw === 'function') {
        thisComponent.setAutoDraw(false);
      }
    }
    // Routines running outside a loop should always advance the datafile row
    if (currentLoop === psychoJS.experiment) {
      psychoJS.experiment.nextEntry(snapshot);
    }
    return Scheduler.Event.NEXT;
  }
}


var _key_resp_5_allKeys;
var BreakComponents;
function BreakRoutineBegin(snapshot) {
  return async function () {
    TrialHandler.fromSnapshot(snapshot); // ensure that .thisN vals are up to date
    
    //--- Prepare to start Routine 'Break' ---
    t = 0;
    BreakClock.reset(); // clock
    frameN = -1;
    continueRoutine = true; // until we're told otherwise
    // update component parameters for each repeat
    key_resp_5.keys = undefined;
    key_resp_5.rt = undefined;
    _key_resp_5_allKeys = [];
    // Run 'Begin Routine' code from code
    if ((((trials.thisRepN % 24) !== 0) || (trials.thisRepN === 0))) {
        continueRoutine = false;
    }
    
    // keep track of which components have finished
    BreakComponents = [];
    BreakComponents.push(key_resp_5);
    BreakComponents.push(text_4);
    
    for (const thisComponent of BreakComponents)
      if ('status' in thisComponent)
        thisComponent.status = PsychoJS.Status.NOT_STARTED;
    return Scheduler.Event.NEXT;
  }
}


function BreakRoutineEachFrame() {
  return async function () {
    //--- Loop for each frame of Routine 'Break' ---
    // get current time
    t = BreakClock.getTime();
    frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
    // update/draw components on each frame
    
    // *key_resp_5* updates
    if (t >= 0.0 && key_resp_5.status === PsychoJS.Status.NOT_STARTED) {
      // keep track of start time/frame for later
      key_resp_5.tStart = t;  // (not accounting for frame time here)
      key_resp_5.frameNStart = frameN;  // exact frame index
      
      // keyboard checking is just starting
      psychoJS.window.callOnFlip(function() { key_resp_5.clock.reset(); });  // t=0 on next screen flip
      psychoJS.window.callOnFlip(function() { key_resp_5.start(); }); // start on screen flip
      psychoJS.window.callOnFlip(function() { key_resp_5.clearEvents(); });
    }

    if (key_resp_5.status === PsychoJS.Status.STARTED) {
      let theseKeys = key_resp_5.getKeys({keyList: ['space'], waitRelease: false});
      _key_resp_5_allKeys = _key_resp_5_allKeys.concat(theseKeys);
      if (_key_resp_5_allKeys.length > 0) {
        key_resp_5.keys = _key_resp_5_allKeys[_key_resp_5_allKeys.length - 1].name;  // just the last key pressed
        key_resp_5.rt = _key_resp_5_allKeys[_key_resp_5_allKeys.length - 1].rt;
        // a response ends the routine
        continueRoutine = false;
      }
    }
    
    
    // *text_4* updates
    if (t >= 0.0 && text_4.status === PsychoJS.Status.NOT_STARTED) {
      // keep track of start time/frame for later
      text_4.tStart = t;  // (not accounting for frame time here)
      text_4.frameNStart = frameN;  // exact frame index
      
      text_4.setAutoDraw(true);
    }

    // check for quit (typically the Esc key)
    if (psychoJS.experiment.experimentEnded || psychoJS.eventManager.getKeys({keyList:['escape']}).length > 0) {
      return quitPsychoJS('The [Escape] key was pressed. Goodbye!', false);
    }
    
    // check if the Routine should terminate
    if (!continueRoutine) {  // a component has requested a forced-end of Routine
      return Scheduler.Event.NEXT;
    }
    
    continueRoutine = false;  // reverts to True if at least one component still running
    for (const thisComponent of BreakComponents)
      if ('status' in thisComponent && thisComponent.status !== PsychoJS.Status.FINISHED) {
        continueRoutine = true;
        break;
      }
    
    // refresh the screen if continuing
    if (continueRoutine) {
      return Scheduler.Event.FLIP_REPEAT;
    } else {
      return Scheduler.Event.NEXT;
    }
  };
}


function BreakRoutineEnd(snapshot) {
  return async function () {
    //--- Ending Routine 'Break' ---
    for (const thisComponent of BreakComponents) {
      if (typeof thisComponent.setAutoDraw === 'function') {
        thisComponent.setAutoDraw(false);
      }
    }
    key_resp_5.stop();
    // the Routine "Break" was not non-slip safe, so reset the non-slip timer
    routineTimer.reset();
    
    // Routines running outside a loop should always advance the datafile row
    if (currentLoop === psychoJS.experiment) {
      psychoJS.experiment.nextEntry(snapshot);
    }
    return Scheduler.Event.NEXT;
  }
}


var _key_resp_4_allKeys;
var ByeByeComponents;
function ByeByeRoutineBegin(snapshot) {
  return async function () {
    TrialHandler.fromSnapshot(snapshot); // ensure that .thisN vals are up to date
    
    //--- Prepare to start Routine 'ByeBye' ---
    t = 0;
    ByeByeClock.reset(); // clock
    frameN = -1;
    continueRoutine = true; // until we're told otherwise
    // update component parameters for each repeat
    key_resp_4.keys = undefined;
    key_resp_4.rt = undefined;
    _key_resp_4_allKeys = [];
    // keep track of which components have finished
    ByeByeComponents = [];
    ByeByeComponents.push(text_3);
    ByeByeComponents.push(key_resp_4);
    
    for (const thisComponent of ByeByeComponents)
      if ('status' in thisComponent)
        thisComponent.status = PsychoJS.Status.NOT_STARTED;
    return Scheduler.Event.NEXT;
  }
}


function ByeByeRoutineEachFrame() {
  return async function () {
    //--- Loop for each frame of Routine 'ByeBye' ---
    // get current time
    t = ByeByeClock.getTime();
    frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
    // update/draw components on each frame
    
    // *text_3* updates
    if (t >= 0.0 && text_3.status === PsychoJS.Status.NOT_STARTED) {
      // keep track of start time/frame for later
      text_3.tStart = t;  // (not accounting for frame time here)
      text_3.frameNStart = frameN;  // exact frame index
      
      text_3.setAutoDraw(true);
    }

    
    // *key_resp_4* updates
    if (t >= 0.0 && key_resp_4.status === PsychoJS.Status.NOT_STARTED) {
      // keep track of start time/frame for later
      key_resp_4.tStart = t;  // (not accounting for frame time here)
      key_resp_4.frameNStart = frameN;  // exact frame index
      
      // keyboard checking is just starting
      psychoJS.window.callOnFlip(function() { key_resp_4.clock.reset(); });  // t=0 on next screen flip
      psychoJS.window.callOnFlip(function() { key_resp_4.start(); }); // start on screen flip
      psychoJS.window.callOnFlip(function() { key_resp_4.clearEvents(); });
    }

    if (key_resp_4.status === PsychoJS.Status.STARTED) {
      let theseKeys = key_resp_4.getKeys({keyList: ['space'], waitRelease: false});
      _key_resp_4_allKeys = _key_resp_4_allKeys.concat(theseKeys);
      if (_key_resp_4_allKeys.length > 0) {
        key_resp_4.keys = _key_resp_4_allKeys[_key_resp_4_allKeys.length - 1].name;  // just the last key pressed
        key_resp_4.rt = _key_resp_4_allKeys[_key_resp_4_allKeys.length - 1].rt;
        // a response ends the routine
        continueRoutine = false;
      }
    }
    
    // check for quit (typically the Esc key)
    if (psychoJS.experiment.experimentEnded || psychoJS.eventManager.getKeys({keyList:['escape']}).length > 0) {
      return quitPsychoJS('The [Escape] key was pressed. Goodbye!', false);
    }
    
    // check if the Routine should terminate
    if (!continueRoutine) {  // a component has requested a forced-end of Routine
      return Scheduler.Event.NEXT;
    }
    
    continueRoutine = false;  // reverts to True if at least one component still running
    for (const thisComponent of ByeByeComponents)
      if ('status' in thisComponent && thisComponent.status !== PsychoJS.Status.FINISHED) {
        continueRoutine = true;
        break;
      }
    
    // refresh the screen if continuing
    if (continueRoutine) {
      return Scheduler.Event.FLIP_REPEAT;
    } else {
      return Scheduler.Event.NEXT;
    }
  };
}


function ByeByeRoutineEnd(snapshot) {
  return async function () {
    //--- Ending Routine 'ByeBye' ---
    for (const thisComponent of ByeByeComponents) {
      if (typeof thisComponent.setAutoDraw === 'function') {
        thisComponent.setAutoDraw(false);
      }
    }
    key_resp_4.stop();
    // the Routine "ByeBye" was not non-slip safe, so reset the non-slip timer
    routineTimer.reset();
    
    // Routines running outside a loop should always advance the datafile row
    if (currentLoop === psychoJS.experiment) {
      psychoJS.experiment.nextEntry(snapshot);
    }
    return Scheduler.Event.NEXT;
  }
}


function importConditions(currentLoop) {
  return async function () {
    psychoJS.importAttributes(currentLoop.getCurrentTrial());
    return Scheduler.Event.NEXT;
    };
}


async function quitPsychoJS(message, isCompleted) {
  // Check for and save orphaned data
  if (psychoJS.experiment.isEntryEmpty()) {
    psychoJS.experiment.nextEntry();
  }
  
  
  
  
  
  
  
  
  psychoJS.window.close();
  psychoJS.quit({message: message, isCompleted: isCompleted});
  
  return Scheduler.Event.QUIT;
}