Skip to content

Langton's Ant implementation based on Python and Pygame

Notifications You must be signed in to change notification settings

xAlessandroC/langtons-ant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Langton's Ant

Implementation of Langton's Ant cellular automata in Python.

Configuration

The software is based on some configuration parameters to be set as environmental variables (or directly in the code):

  • WIDTH: the width of the grid - default is 1280
  • HEIGHT: the height of the grid - default is 720
  • RESOLUTION: the resolution of the grid cells - default is 5
  • RULE: the rule to be applied to the ant - default is RL

The RULE parameter is a string of N parameters describing the behaviour of the ant. The first two colors are black and white respectively, and the following N-2 colors are randomly generated.

How to run

Install the dependencies:

pip install -r requirements.txt

run the script:

python ant.py

Examples

Rule: RL

Example of Langton's Ant with Rule RL

Rule: LLRR

Example of Langton's Ant with Rule RL

Rule: LRRRRRLLR

Example of Langton's Ant with Rule RL

About

Langton's Ant implementation based on Python and Pygame

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages