This applet implements Chris Langton's Ant, or Virtual Ant, or Vant.
More comments below... Push the ">" button to play. (Netscape users:
trouble? see the note below.)
This vant follows the rule: if you're on a white square, turn it black, turn
left and step forward. If you're on a black square, turn it white, turn right
and step forward. This is the simplest kind of Vant, rule "number 2."
More complicated vant rules have been explored;
check these links for more writings and
software.
This vant is running on a grid that wraps around from left to right and top
to bottom. Also, the applet lets you initialize the grid with
patterns of dots
instead of just all white. I think this setup shows more fun
behavior--in particular, sometimes it tears down and rebuilds things it's
already built, because of a special kind of reversability the number 2 vant
rule has in a wrap-around world.
The source code is in LangtonsAnt.java.
The CheapVector class is in CheapVector.java.
This applet started out as a Life program that Peter N Lewis
<peter@stairways.com.au>
wrote and MetroWorks distributed with their Code Warrior development
environment.
Netscape note:
On Netscape--at least version 4.6 on the Mac, this applet sometimes
clears without redrawing. Some
tricks that sometimes help:
- put another window over the Netscape window
then take it away
- scroll down to the bottom of this page, then back up to the top
- memorize where the buttons and controls are and
try to hit them (they're there even though they're not showing!).
Debugging help appreciated.