{"size": 877, "ext": "js", "max_stars_repo_path": "shared/createBlocks.js", "max_stars_repo_name": "vekteo/Nback_JSPsych", "max_stars_repo_stars_event_min_datetime": "2022-03-03T02:28:01.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-03T02:28:01.000Z", "max_issues_repo_path": "shared/createBlocks.js", "max_issues_repo_name": "vekteo/Nback_jsPsych", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "shared/createBlocks.js", "max_forks_repo_name": "vekteo/Nback_jsPsych", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.0571428571, "max_line_length": 220, "alphanum_fraction": 0.5370581528}
function createBlocks(list, stimuli, level){
  for (let i = 0; i < list.length; i++) {

    if (level === 0){
      targetStimulus = "X"
    }
    else {
      targetStimulus = list[i-level];
    }

    if(i > 0) {
      if (list[i] === targetStimulus){
        correctResponse = "j" 
        target = 1;
      } else {
        correctResponse = "f"
        target = 0;
      }
    } else {
      correctResponse = "f"
      target = 0;
    }
    
    if (list == nbackStimuli.practiceList){
      block = 0;
    } else if (list == nbackStimuli.stimuliListFirstBlock) {
      block = 1
    } else {
      block = 2
    }

    let newElement = { stimulus: "<p class='stimulus'>" + list[i] + "</p>", data: { test_part: 'test', level: level, correct_response: correctResponse, block: block, trial_number: i+1, target: target, letter: list[i] } }
    stimuli.push(newElement)
  }
}