On the Subject of Termites

Bugged module. Pls fix.

  • This module consists of a 9 by 9 grid of cells, each with an LED. At the centre of this grid is a termite facing north.
  • Once active, the termite will begin to move forwards.
    Once it leaves a cell, the on/off state of its LED is toggled.
  • If the termite enters a cell with a lit LED, it will turn to its left or right according to its instruction tape before moving to the next cell and the next instruction in the tape.
    If there are no more instructions in the tape, it is rewound to its first instruction.

To defuse this module, construct the instruction tape used by the termite and determine its path around the grid, then select the point at the edge of the grid from which the termite escapes.

Instruction Tape

  1. Interpret the first character of the serial number as a base 36 digit, and zero-index into the table, in reading order, to obtain the first set of instructions.
  2. The second set of instructions lies in the cell of table whose row is equal to the number of batteries modulo 6, where the top row is row 0, and whose column is equal to the number of ports modulo 6, where the left column is column 0.
  3. Take the sum of the digits in the serial number and the number of indicators modulo 36, and zero-index into the table, in reading order, to obtain the third set of instructions.
  4. Concatenate the three sets of instructions in the order they were obtained.
  5. If the tape has an even number of instructions, remove the last.
  6. The tape is checked from left to right for substrings of three inputs repeated twice in a row. If one is discovered, the latter substring is inverted.
  7. The following substrings of instructions are invalid:
    • LLRR
    • RRLL
    • LRLR
    • RLRL
    The tape is checked from left to right for invalid substrings.
    If one is discovered, the last instruction in the invalid substring is inverted.
RLLRRLRRLRLRRLRLL
LRRLRRLRLLRRLRLRRLL
RLLRLRLRLRRRRLRLLRL
LRLRRRLLLRLLRRL
LRRLLRLLRRLLRRLLLRL
RRRLLLRRLRLLRLL

Controls

  • Click a cell to toggle between occupied and empty.
  • Right-Click a cell to mark it with a dot.
  • Use the buttons to save the state, reset saves, reset the grid, or reset everything.