Langton-SDL

SDL implementation of Langton’s Ant with configurable worlds and multiple ants.

A small cellular-automaton experiment originally written for MS-DOS in 1998 and ported to SDL in 2002.

  • C++ sample
  • SDL 1.2
  • Cellular automaton
  • Langton’s Ant
  • Source available

Overview

Langton’s Ant is a simple deterministic discrete dynamical system. It can be viewed as a cellular automaton, a two-dimensional Turing machine or an agent system.

The world is usually represented as a square grid. Each cell has a state, and each ant moves through the grid by changing the state of the cell it visits and turning according to that state.

Langton-SDL recreates this world with SDL 1.2 and can be configured through an external langton.ini file.

Screenshots

Langton's Ant with 5 ants
Langton's Ant with 1 ant

Details

Simulation

  • Custom number of ants, positions and speeds through an external .ini file with Spanish comments.
  • Creates a BMP screenshot and outputs execution statistics when the run finishes.
  • After enough steps, the ants tend to build the characteristic diagonal highway.

Ant Rules

  • The first movement is based on the configured initial direction.
  • If the ant moves onto a non-red cell, the cell becomes red and the ant turns 90 degrees right.
  • If the ant moves onto a red cell, the cell becomes non-red and the ant turns 90 degrees left.

Platform and Build

  • Windows x86 binary package is available.
  • The historical code targets Linux, Mac OS X and Windows era systems.
  • Linux and Mac OS X makefiles are not included.
  • Developed in C++ using SDL 1.2.

Download

Latest version: v1.00 (15-June-2002)
ChangeLog | Roadmap | Free and open-source

Binaries
32-bit binaries for supported operating systems.
Source code
Source code and project files for VS2003+.
Previous releases
Get access to all releases repository.