<commit_before>import { iterate } from './state_machine';
import { resetTasks } from './tasks';

export function manageTasks(room: Room) {
  resetTasks(room);
  for (const c of room.myCreeps) {
    for (let i = 0; iterate(c) && i < 3; i++) {
      // spin
    }
  }
}
<commit_msg>Catch individual errors when managing creeps.<commit_after>import { iterate } from './state_machine';
import { resetTasks } from './tasks';

export function manageTasks(room: Room) {
  resetTasks(room);
  for (const c of room.myCreeps) {
    for (let i = 0; i < 3; i++) {
      try {
        if (!iterate(c)) {
          break;
        }
      } catch (ex) {
        log.error(`Error while managing ${c}`);
        log.trace(ex);
        c.memory.state = 'default';
        delete c.memory.value;
      }
    }
  }
}

{'fraction_non_alphanumeric': 0.15432873274780426, 'fraction_numerical': 0.005018820577164366, 'mean_word_length': 2.367088607594937, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3054459', 'n_tokens_mistral': 271, 'n_tokens_neox': 261, 'n_words': 72}