<commit_before>namespace Lantern {
  const int snakesCount = 50;
  const int circumference = LEDS_PER_ROW;
  int numberOfSparkles = 0;
  bool increasing = true;
  uint8_t hue = 50;

  int curve(int value, int difference, int maximum) {
    if (value < maximum && increasing) {
      value += difference;
    } else if (value > 1) {
      value -= difference;
      increasing = false;
    } else {
      increasing = true;
      value += difference;
    }
    return value;
  }

  uint16_t snakes[snakesCount];
  int snake = 0;

  void shootingStar() {
    snakes[snake] = random(LEDS_PER_ROW);
    snake++;
    if (snake >= snakesCount) snake = 0;
  }

  void lanternPattern() {
    EVERY_N_MILLISECONDS(40) {
      for (int i = 0; i < snakesCount; i++) {
        uint16_t j = snakes[i];
        if (j > 0) {
          // Different hue for shooting stars
          Soulmate::led_arr[j] = CHSV(hue + j / 10 + 10, 240, 255);

          snakes[i] += circumference+1;
          if (snakes[i] >= N_LEDS) snakes[i] = 0;
        }
      }
    }

    EVERY_N_MILLISECONDS(10) {
      if (random16(N_LEDS * 0.4) < numberOfSparkles) {
        shootingStar();
      }
    }

    EVERY_N_MILLISECONDS(10) {
      fade_raw(Soulmate::led_arr, N_LEDS, 1);
    }

    EVERY_N_MILLISECONDS(60) {
      for (int i = 0; i < numberOfSparkles; i++) {
        int pos = random16(N_LEDS);
        if (!Soulmate::led_arr[pos]) {
          Soulmate::led_arr[pos] = CHSV(hue + (pos / 15), 255, 128);
        }
      }
    }

    EVERY_N_MILLISECONDS(200) {
      numberOfSparkles = curve(numberOfSparkles, 4, N_LEDS * 0.03);
    }

    EVERY_N_MILLISECONDS(100) {
      hue -= 1;
    }
  }
}

void lantern() {
  Lantern::lanternPattern();<commit_msg>New lantern<commit_after>namespace Lantern {
  const int snakesCount = 10;
  const int circumference = LEDS_PER_ROW;
  int numberOfSparkles = 0;
  bool increasing = true;
  uint8_t hue = 50;

  uint16_t snakes[snakesCount];
  int snake = 0;

  void shootingStar() {
    snakes[snake] = random(LEDS_PER_ROW);
    snake++;
    if (snake >= snakesCount) snake = 0;
  }

  void lanternPattern() {
    numberOfSparkles = beatsin16(15, 4, N_LEDS * 0.03);

    EVERY_N_MILLISECONDS(100) {
      hue -= 1;
    }
    
    EVERY_N_MILLISECONDS(40) {
      for (int i = 0; i < snakesCount; i++) {
        uint16_t j = snakes[i];
        if (j > 0) {
          if (j > 1) {
            Soulmate::led_arr[j-1] = CHSV(hue + j / 10 + 10, 180, 100);
          }
          Soulmate::led_arr[j] = CHSV(hue + j / 10 + 10, 180, 180);
          if (j < N_LEDS - 1) {
            Soulmate::led_arr[j+1] = CHSV(hue + j / 10 + 10, 180, 100);
          }

          // angle
          snakes[i] += circumference + 1;
          if (snakes[i] >= N_LEDS) snakes[i] = 0;
        }
      }
    }

    EVERY_N_MILLISECONDS(10) {
      if (random16(N_LEDS * 0.4) < numberOfSparkles) {
        shootingStar();
      }
      fade_raw(Soulmate::led_arr, N_LEDS, 1);
    }

    EVERY_N_MILLISECONDS(60) {
      for (int i = 0; i < numberOfSparkles; i++) {
        int pos = random16(N_LEDS);
        if (!Soulmate::led_arr[pos]) {
          Soulmate::led_arr[pos] = CHSV(hue + (pos / 15), 255, 128);
        }
      }
    }
  }
}

void lantern() {
  Lantern::lanternPattern();
{'fraction_non_alphanumeric': 0.13751914241960184, 'fraction_numerical': 0.044716692189892805, 'mean_word_length': 2.1253588516746413, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '5495138', 'n_tokens_mistral': 1401, 'n_tokens_neox': 1253, 'n_words': 264}