enter image description here

Wireworld is fun for the whole family! Your goal is to create a Wireworld implementation in the shortest amount of code possible.

A Wireworld cell can be in one of four different states, usually numbered 0–3 in software, modeled by colors in the examples here:

  • Empty (Black)
  • Electron head (Blue)
  • Electron tail (Red)
  • Conductor (Yellow)

As in all cellular automata, time proceeds in ticks. Cells behave as follows:

  • Empty → Empty
  • Electron head → Electron tail
  • Electron tail → Conductor
  • Conductor → Electron head if exactly one or two of the neighbouring cells are electron heads, or remains Conductor otherwise.

Your grid must be at least 20 by 20 and must follow the rules of Wireworld. The grid doesn't have to be colored, but make sure it follows these numbers/symbols:

  • Empty (0 or ' ')
  • Electron head (2 or 'H')
  • Electron tail (3 or 'T')
  • Conductor (1 or '_')
  • 1
    \$\begingroup\$ What does the implementation need to do? Take an input state onto the output state one tick later? \$\endgroup\$
    – xnor
    Commented Jul 3, 2015 at 5:05
  • \$\begingroup\$ Also, beware that Mathematica and probably other languages have built-ins for cellular automata. \$\endgroup\$
    – xnor
    Commented Jul 3, 2015 at 5:09
  • \$\begingroup\$ @xnor it needs to run on a clock and tick ever few seconds or so \$\endgroup\$
    – jado
    Commented Jul 3, 2015 at 5:10
  • \$\begingroup\$ does the board wrap? \$\endgroup\$
    – Maltysen
    Commented Jul 3, 2015 at 5:30
  • \$\begingroup\$ As this is an unusual duplicate case, I'm going to ask a question on Meta about it. \$\endgroup\$ Commented Jul 3, 2015 at 6:08


Browse other questions tagged or ask your own question.