Esta página en español You're in the english version

The applet: instructions

An ant There are lots of applets on the web which simulate Langton's ant on the square grid, usually allowing the user to change the states in a few cells before letting the ant run. Our applet does a lot more than this: you can switch between the different grids (including general graphs, which you are allowed to edit), you can run the ant forward and backward, you can highlight its trace, mark certain cells, and load some interesting initial configurations. File I/O is not included in this version, due to the security restrictions imposed to applets.


Click this arrow Go to the applet (link and warnings)
Click this arrow How to use it
Click this arrow What's available in the initial configurations
Click this arrow Download Java classes and source

The way to the applet

here to open the applet. This will cause a new window to pop up, and will try to create it with the maximum size available on your screen. If you don't want this to happen (it may be annoying), then you can click here to open it in the present window, with the present size... But remember that in Netscape applets are not resized when you resize the window that contains it.

Warning for Linux users: We have seen the applet hanging up in Linux... And not only did Netscape hang up, but the whole terminal session. Any help from Linux-experienced Java programmers is welcome (for the source code, see below).


As you will see, there is a control panel with buttons and boxes on the left, and a simulation panel on the right. We will describe first the elements on the left, starting with the top one. Then we will explain how to edit the configurations on the right.

Please take note that there are many elements in the control panel; a low-resolution screen configuration, or a web browser with too many toolbars, may hide some buttons from view. This is why we recommend opening the applet in a maximized window.

The Control Panel

Editing the Simulation Panel

Grids: Graphs:

The available configurations

For the hexagonal grid:
For the square grid: For the triangular grid: nothing. For general graphs:

Download classes and source

By clicking
here you can download a zipped file which contains the source code of the applet, the compiled classes, this html file and the html where the applet is opened; thus you can unzip it to a directory, and run the whole thing offline. This is also a chance for Linux users that have trouble with the browser: try to run it with the Appletviewer.

The code is not copyrighted; anyway, I think it would be fair at least to mention the name of the programmer (Andrés Moreira) if you use the applet somewhere.

If you want to modify it, I apologize in advance for the absence of comments, the bad Java style, and the spanglish in the names of variable and methods. If you do any valuable extension to the program, please let me know (, and check the copyright information.

Last updated: 03-31-2002.