This applet needs Java version 1.2 or greater to run. Go to java.com to update youir browser.

Keybindings

KeyAction
'+' or '='Speed up the applet.
'-'Slow down.
Ctrl+Shift+'R'Restart
spacebarpause

A description of the RotorRouter Algorithm

The program will drop a grain of sand at the center cell in the n X n grid. Initially all the cells are pointed in the up direction. Everytime a grain of sand touches a cell the arrow the cell is pointing rotates clockwise. Grains of sand are routed via the direction of the cell arrow. Note a grain of sand is routed first then the arrow changes direction. A grain of sand moves until it finds a empty cell.

What do the colors mean:

If a cell is empty is has the color white.

If a cell is occupied and the arrow is pointing up, it has the color yellow.

If a cell is occupied and the arrow is pointing right, it has the color green.

If a cell is occupied and the arrow is pointing down, it has the color blue.

If a cell is occupied and the arrow is pointing left, it has the color red.

Colors are displayed after a grain of sand has moved into an unoccupied cell.