<commit_before>var RATE = 10;

function initMemory() {
  if (!Memory.rooms) {
    Memory.rooms = {};
  }
  for (var room in Game.rooms) {
    if (!Memory.rooms[room]) {
      var defaults = {
        maxCreeps: 7
      };
      Memory.rooms[room] = defaults;
    }
  }
}

function checkEnergy() {
  if (Game.time % RATE != 0) {
    return;
  }
  for (var name in Game.rooms) {
    var room = Game.rooms[name];
    var sources = room.find(FIND_SOURCES);
    var wastedEnergy = 0;
    var wastedTicks = 999;

    for (var source of sources) {
      var energy = source.energy;
      var toRegen = source.ticksToRegeneration;

      // if a source is about to regen, see if it has wasted energy
      if (toRegen <= RATE) {
        wastedEnergy += energy;
      }
      // if a source has energy we haven't wasted any ticks
      if (energy > 0) {
        wastedTicks = 0;
      } else if (energy === 0) {
        wastedTicks = Math.min(wastedTicks, toRegen);
      }
    }
    room.log('Optimizer ran: wasted ticks = ' + wastedTicks + ' and energy = ' + wastedEnergy);

    // make adjustments if necessary
    var numCreeps = room.find(FIND_MY_CREEPS).length;
    if (wastedEnergy > 500) {
      room.log('Too much wasted energy, increasing creeps. Saw ' + wastedEnergy);
      Memory.rooms[name].maxCreeps = numCreeps + 1;
    } else if (wastedTicks > 50) {
      room.log('Too many wasted ticks, decreasing creeps. Saw ' + wastedTicks);<commit_msg>turn down logging<commit_after>var RATE = 10;

function initMemory() {
  if (!Memory.rooms) {
    Memory.rooms = {};
  }
  for (var room in Game.rooms) {
    if (!Memory.rooms[room]) {
      var defaults = {
        maxCreeps: 7
      };
      Memory.rooms[room] = defaults;
    }
  }
}

function checkEnergy() {
  if (Game.time % RATE != 0) {
    return;
  }
  for (var name in Game.rooms) {
    var room = Game.rooms[name];
    var sources = room.find(FIND_SOURCES);
    var wastedEnergy = 0;
    var wastedTicks = 999;

    for (var source of sources) {
      var energy = source.energy;
      var toRegen = source.ticksToRegeneration;

      // if a source is about to regen, see if it has wasted energy
      if (toRegen <= RATE) {
        wastedEnergy += energy;
      }
      // if a source has energy we haven't wasted any ticks
      if (energy > 0) {
        wastedTicks = 0;
      } else if (energy === 0) {
        wastedTicks = Math.min(wastedTicks, toRegen);
      }
    }

    // make adjustments if necessary
    var numCreeps = room.find(FIND_MY_CREEPS).length;
    if (wastedEnergy > 500) {
      room.log('Too much wasted energy, increasing creeps. Saw ' + wastedEnergy);
      Memory.rooms[name].maxCreeps = numCreeps + 1;
    } else if (wastedTicks > 50) {
      room.log('Too many wasted ticks, decreasing creeps. Saw ' + wastedTicks);
{'fraction_non_alphanumeric': 0.11903064861012116, 'fraction_numerical': 0.012116892373485389, 'mean_word_length': 2.3496420047732696, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '4704233', 'n_tokens_mistral': 982, 'n_tokens_neox': 911, 'n_words': 267}