<commit_before>void updateData(menuOpt mo) {
  for (int j = 0; j < menuOpts.length; j++) if (menuOpts[j].rightside == mo.rightside) menuOpts[j].selected = false;
  mo.selected = true;

  if (!mo.rightside) {
    float[] data = new float[continents.length];
    for (int i = 0; i < continents.length; i++) {
      for (int j = 0; j < statsOpts.length; j++) {
        if (statsOpts[j].subtext.toLowerCase().equals(continents[i].dataPoint.continentName.toLowerCase())) {
          if (mo.text.equals("CIGARETTES")) { 
            statsOpts[j].headline = str(continents[i].dataPoint.cigarettes) + "%"; 
            data[i] = continents[i].dataPoint.cigarettes;
          } else if (mo.text.equals("OPIATES")) { 
            statsOpts[j].headline = str(continents[i].dataPoint.opiates) + "%";  
            data[i] = continents[i].dataPoint.opiates;
          } else if (mo.text.equals("AMPHETAMINE")) { 
            statsOpts[j].headline = str(continents[i].dataPoint.amphetamine) + "%"; 
            data[i] = continents[i].dataPoint.amphetamine;
          } else if (mo.text.equals("COCAINE")) { 
            statsOpts[j].headline = str(continents[i].dataPoint.cocaine) + "%"; 
            data[i] = continents[i].dataPoint.cocaine;
          } else if (mo.text.equals("ECSTACY")) { 
            statsOpts[j].headline = str(continents[i].dataPoint.ecstacy) + "%"; 
            data[i] = continents[i].dataPoint.ecstacy;
          } else if (mo.text.equals("CANNABIS")) { 
            statsOpts[j].headline = str(continents[i].dataPoint.cannabis) + "%"; 
            data[i] = continents[i].dataPoint.cannabis;
          }
        }
      }
    }
    arduino.SetDrugType(data);
  }


  if (mo.rightside) {
    for (int i = 0; i < continents.length; i++) {
      if (mo.text.equals("SEXLIFE SATISFACTION")) {
        color c1 = color(#fff746);
        color c2 = color(#ff0201);
        float[] stats = new float[6];
        for (int j = 0; j < continents.length; j++) stats[j] = continents[j].dataPoint.sexLifeSatisfaction;
        float max = max(stats);
        float min = min(stats);
        scaleMin=min;
        scaleMax=max;

        asic = lerpColor(c1, c2, norm(stats[4], min, max));//4
        eurc = lerpColor(c1, c2, norm(stats[3], min, max));//3
        samc = lerpColor(c1, c2, norm(stats[5], min, max));//5
        namc = lerpColor(c1, c2, norm(stats[2], min, max));//2
        afrc = lerpColor(c1, c2, norm(stats[1], min, max));//1
        ocec = lerpColor(c1, c2, norm(stats[0], min, max));//0

        scale = sexS;

        arduino.SetColors(new color[] {asic, namc, afrc, samc, eurc, ocec});

        return;
      }

      if (mo.text.equals("UFO SIGHTINGS")) {
        color c1 = color(#ffffff);
        color c2 = color(#9845ff);
        float[] stats = new float[6];
        for (int j = 0; j < continents.length; j++) stats[j] = continents[j].dataPoint.UFOSightings;
        float max = max(stats);
        float min = min(stats);
        scaleMin=min;
        scaleMax=max;

        asic = lerpColor(c1, c2, norm(stats[4], min, max));//4
        eurc = lerpColor(c1, c2, norm(stats[3], min, max));//3
        samc = lerpColor(c1, c2, norm(stats[5], min, max));//5
        namc = lerpColor(c1, c2, norm(stats[2], min, max));//2
        afrc = lerpColor(c1, c2, norm(stats[1], min, max));//1
        ocec = lerpColor(c1, c2, norm(stats[0], min, max));//0

        scale = ufoS;

        arduino.SetColors(new color[] {asic, namc, afrc, samc, eurc, ocec});

        return;
      }

      if (mo.text.equals("HOMICIDE RATE")) {
        color c1 = color(#249afe);
        color c2 = color(#ff0c0d);
        float[] stats = new float[6];
        for (int j = 0; j < continents.length; j++) stats[j] = continents[j].dataPoint.homocideRate;
        float max = max(stats);
        float min = min(stats);
        scaleMin=min;
        scaleMax=max;

        asic = lerpColor(c1, c2, norm(stats[4], min, max));//4
        eurc = lerpColor(c1, c2, norm(stats[3], min, max));//3
        samc = lerpColor(c1, c2, norm(stats[5], min, max));//5
        namc = lerpColor(c1, c2, norm(stats[2], min, max));//2
        afrc = lerpColor(c1, c2, norm(stats[1], min, max));//1
        ocec = lerpColor(c1, c2, norm(stats[0], min, max));//0

        scale = homiS;

        arduino.SetColors(new color[] {asic, namc, afrc, samc, eurc, ocec});

        return;
      }

      if (mo.text.equals("DRUG RELATED DEATHS")) {
        color c1 = color(#ff6508);
        color c2 = color(#91ff78);
        float[] stats = new float[6];
        for (int j = 0; j < continents.length; j++) stats[j] = continents[j].dataPoint.drugRelatedDeaths;
        float max = max(stats);
        float min = min(stats);
        scaleMin=min;
        scaleMax=max;

        asic = lerpColor(c1, c2, norm(stats[4], min, max));//4
        eurc = lerpColor(c1, c2, norm(stats[3], min, max));//3
        samc = lerpColor(c1, c2, norm(stats[5], min, max));//5
        namc = lerpColor(c1, c2, norm(stats[2], min, max));//2
        afrc = lerpColor(c1, c2, norm(stats[1], min, max));//1
        ocec = lerpColor(c1, c2, norm(stats[0], min, max));//0

        scale = drugS;

        arduino.SetColors(new color[] {asic, namc, afrc, samc, eurc, ocec});

        return;
      }

      if (mo.text.equals("GDP PER CAPITA")) {
        color c1 = color(#ffffff);
        color c2 = color(#36ff01);
        float[] stats = new float[6];
        for (int j = 0; j < continents.length; j++) stats[j] = continents[j].dataPoint.GDP;
        float max = max(stats);
        float min = min(stats);
        scaleMin=min;
        scaleMax=max;

        asic = lerpColor(c1, c2, norm(stats[4], min, max));//4
        eurc = lerpColor(c1, c2, norm(stats[3], min, max));//3
        samc = lerpColor(c1, c2, norm(stats[5], min, max));//5
        namc = lerpColor(c1, c2, norm(stats[2], min, max));//2
        afrc = lerpColor(c1, c2, norm(stats[1], min, max));//1
        ocec = lerpColor(c1, c2, norm(stats[0], min, max));//0

        scale = gdpS;

        arduino.SetColors(new color[] {asic, namc, afrc, samc, eurc, ocec});

        println(norm(stats[5], min, max), norm(stats[3], min, max), norm(stats[1], min, max), norm(stats[2], min, max), norm(stats[0], min, max), norm(stats[4], min, max));

        return;
      }

      if (mo.text.equals("OVERWEIGHT")) {
        color c1 = color(#abff89);
        color c2 = color(#ff309b);
        float[] stats = new float[6];
        for (int j = 0; j < continents.length; j++) stats[j] = continents[j].dataPoint.overweight;
        float max = max(stats);
        float min = min(stats);
        scaleMin=min;
        scaleMax=max;

        asic = lerpColor(c1, c2, norm(stats[4], min, max));//4
        eurc = lerpColor(c1, c2, norm(stats[3], min, max));//3
        samc = lerpColor(c1, c2, norm(stats[5], min, max));//5
        namc = lerpColor(c1, c2, norm(stats[2], min, max));//2
        afrc = lerpColor(c1, c2, norm(stats[1], min, max));//1
        ocec = lerpColor(c1, c2, norm(stats[0], min, max));//0

        scale = overS;

        arduino.SetColors(new color[] {asic, namc, afrc, samc, eurc, ocec});

        return;
      }
    }
  }
}

void mousePressed() {
  // Check if we are calibrating
  if (calibrationScreen.active)
    return;
  
  PVector m = new PVector(mouseX, mouseY+50);

  for (int i = 0; i < menuOpts.length; i++) {
    menuOpt mo = menuOpts[i];<commit_msg>Revert "Switched europe with africa again."<commit_after>void updateData(menuOpt mo) {
  for (int j = 0; j < menuOpts.length; j++) if (menuOpts[j].rightside == mo.rightside) menuOpts[j].selected = false;
  mo.selected = true;

  if (!mo.rightside) {
    float[] data = new float[continents.length];
    for (int i = 0; i < continents.length; i++) {
      for (int j = 0; j < statsOpts.length; j++) {
        if (statsOpts[j].subtext.toLowerCase().equals(continents[i].dataPoint.continentName.toLowerCase())) {
          if (mo.text.equals("CIGARETTES")) { 
            statsOpts[j].headline = str(continents[i].dataPoint.cigarettes) + "%"; 
            data[i] = continents[i].dataPoint.cigarettes;
          } else if (mo.text.equals("OPIATES")) { 
            statsOpts[j].headline = str(continents[i].dataPoint.opiates) + "%";  
            data[i] = continents[i].dataPoint.opiates;
          } else if (mo.text.equals("AMPHETAMINE")) { 
            statsOpts[j].headline = str(continents[i].dataPoint.amphetamine) + "%"; 
            data[i] = continents[i].dataPoint.amphetamine;
          } else if (mo.text.equals("COCAINE")) { 
            statsOpts[j].headline = str(continents[i].dataPoint.cocaine) + "%"; 
            data[i] = continents[i].dataPoint.cocaine;
          } else if (mo.text.equals("ECSTACY")) { 
            statsOpts[j].headline = str(continents[i].dataPoint.ecstacy) + "%"; 
            data[i] = continents[i].dataPoint.ecstacy;
          } else if (mo.text.equals("CANNABIS")) { 
            statsOpts[j].headline = str(continents[i].dataPoint.cannabis) + "%"; 
            data[i] = continents[i].dataPoint.cannabis;
          }
        }
      }
    }
    arduino.SetDrugType(data);
  }


  if (mo.rightside) {
    for (int i = 0; i < continents.length; i++) {
      if (mo.text.equals("SEXLIFE SATISFACTION")) {
        color c1 = color(#fff746);
        color c2 = color(#ff0201);
        float[] stats = new float[6];
        for (int j = 0; j < continents.length; j++) stats[j] = continents[j].dataPoint.sexLifeSatisfaction;
        float max = max(stats);
        float min = min(stats);
        scaleMin=min;
        scaleMax=max;

        asic = lerpColor(c1, c2, norm(stats[4], min, max));//4
        eurc = lerpColor(c1, c2, norm(stats[3], min, max));//3
        samc = lerpColor(c1, c2, norm(stats[5], min, max));//5
        namc = lerpColor(c1, c2, norm(stats[2], min, max));//2
        afrc = lerpColor(c1, c2, norm(stats[1], min, max));//1
        ocec = lerpColor(c1, c2, norm(stats[0], min, max));//0

        scale = sexS;

        arduino.SetColors(new color[] {asic, namc, eurc, samc, afrc, ocec});

        return;
      }

      if (mo.text.equals("UFO SIGHTINGS")) {
        color c1 = color(#ffffff);
        color c2 = color(#9845ff);
        float[] stats = new float[6];
        for (int j = 0; j < continents.length; j++) stats[j] = continents[j].dataPoint.UFOSightings;
        float max = max(stats);
        float min = min(stats);
        scaleMin=min;
        scaleMax=max;

        asic = lerpColor(c1, c2, norm(stats[4], min, max));//4
        eurc = lerpColor(c1, c2, norm(stats[3], min, max));//3
        samc = lerpColor(c1, c2, norm(stats[5], min, max));//5
        namc = lerpColor(c1, c2, norm(stats[2], min, max));//2
        afrc = lerpColor(c1, c2, norm(stats[1], min, max));//1
        ocec = lerpColor(c1, c2, norm(stats[0], min, max));//0

        scale = ufoS;

        arduino.SetColors(new color[] {asic, namc, eurc, samc, afrc, ocec});

        return;
      }

      if (mo.text.equals("HOMICIDE RATE")) {
        color c1 = color(#249afe);
        color c2 = color(#ff0c0d);
        float[] stats = new float[6];
        for (int j = 0; j < continents.length; j++) stats[j] = continents[j].dataPoint.homocideRate;
        float max = max(stats);
        float min = min(stats);
        scaleMin=min;
        scaleMax=max;

        asic = lerpColor(c1, c2, norm(stats[4], min, max));//4
        eurc = lerpColor(c1, c2, norm(stats[3], min, max));//3
        samc = lerpColor(c1, c2, norm(stats[5], min, max));//5
        namc = lerpColor(c1, c2, norm(stats[2], min, max));//2
        afrc = lerpColor(c1, c2, norm(stats[1], min, max));//1
        ocec = lerpColor(c1, c2, norm(stats[0], min, max));//0

        scale = homiS;

        arduino.SetColors(new color[] {asic, namc, eurc, samc, afrc, ocec});

        return;
      }

      if (mo.text.equals("DRUG RELATED DEATHS")) {
        color c1 = color(#ff6508);
        color c2 = color(#91ff78);
        float[] stats = new float[6];
        for (int j = 0; j < continents.length; j++) stats[j] = continents[j].dataPoint.drugRelatedDeaths;
        float max = max(stats);
        float min = min(stats);
        scaleMin=min;
        scaleMax=max;

        asic = lerpColor(c1, c2, norm(stats[4], min, max));//4
        eurc = lerpColor(c1, c2, norm(stats[3], min, max));//3
        samc = lerpColor(c1, c2, norm(stats[5], min, max));//5
        namc = lerpColor(c1, c2, norm(stats[2], min, max));//2
        afrc = lerpColor(c1, c2, norm(stats[1], min, max));//1
        ocec = lerpColor(c1, c2, norm(stats[0], min, max));//0

        scale = drugS;

        arduino.SetColors(new color[] {asic, namc, eurc, samc, afrc, ocec});

        return;
      }

      if (mo.text.equals("GDP PER CAPITA")) {
        color c1 = color(#ffffff);
        color c2 = color(#36ff01);
        float[] stats = new float[6];
        for (int j = 0; j < continents.length; j++) stats[j] = continents[j].dataPoint.GDP;
        float max = max(stats);
        float min = min(stats);
        scaleMin=min;
        scaleMax=max;

        asic = lerpColor(c1, c2, norm(stats[4], min, max));//4
        eurc = lerpColor(c1, c2, norm(stats[3], min, max));//3
        samc = lerpColor(c1, c2, norm(stats[5], min, max));//5
        namc = lerpColor(c1, c2, norm(stats[2], min, max));//2
        afrc = lerpColor(c1, c2, norm(stats[1], min, max));//1
        ocec = lerpColor(c1, c2, norm(stats[0], min, max));//0

        scale = gdpS;

        arduino.SetColors(new color[] {asic, namc, eurc, samc, afrc, ocec});

        println(norm(stats[5], min, max), norm(stats[3], min, max), norm(stats[1], min, max), norm(stats[2], min, max), norm(stats[0], min, max), norm(stats[4], min, max));

        return;
      }

      if (mo.text.equals("OVERWEIGHT")) {
        color c1 = color(#abff89);
        color c2 = color(#ff309b);
        float[] stats = new float[6];
        for (int j = 0; j < continents.length; j++) stats[j] = continents[j].dataPoint.overweight;
        float max = max(stats);
        float min = min(stats);
        scaleMin=min;
        scaleMax=max;

        asic = lerpColor(c1, c2, norm(stats[4], min, max));//4
        eurc = lerpColor(c1, c2, norm(stats[3], min, max));//3
        samc = lerpColor(c1, c2, norm(stats[5], min, max));//5
        namc = lerpColor(c1, c2, norm(stats[2], min, max));//2
        afrc = lerpColor(c1, c2, norm(stats[1], min, max));//1
        ocec = lerpColor(c1, c2, norm(stats[0], min, max));//0

        scale = overS;

        arduino.SetColors(new color[] {asic, namc, eurc, samc, afrc, ocec});

        return;
      }
    }
  }
}

void mousePressed() {
  // Check if we are calibrating
  if (calibrationScreen.active)
    return;
  
  PVector m = new PVector(mouseX, mouseY+50);

  for (int i = 0; i < menuOpts.length; i++) {
    menuOpt mo = menuOpts[i];
{'fraction_non_alphanumeric': 0.17664912990692028, 'fraction_numerical': 0.028868204505598273, 'mean_word_length': 2.3967926689576173, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7365751', 'n_tokens_mistral': 5794, 'n_tokens_neox': 5463, 'n_words': 1196}