Skip to content

EuReinoso/Langton-Ant-Automata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Langton Ant 🐜

Langton's ant is an automata devised by 'Chris Langton'. It is a two-dimensional Turing machine, with simple rules, but with surprising visual results.

How it Works?

The rules for the operation of this automata are as follows:

  • The ant is given a set of colors.
  • Each color has a 'rule' that says whether the ant should go right or left.
  • Every time the ant passes through a square, it changes to the next color in the set.

Learn More

Example of a set:

Whats the point?

The purpose of this experiment is to visualize the pattern formed by the ant's path. It is also a great way to study and improve some progamming concepts.

How to use?

Libraries

If you dont have the python libriries 'pygame' and 'numpy', first install it.

You can install using pip command on terminal:

  • pygame

      pip install pygame
    
  • numpy

      pip install numpy
    

Guide

The code already comes with a color pattern and predefined rules, if you want to see different pattern try changing the 'graf' variable.

graf = Grafs.create_graf('lllrrr')

The function parameter 'lllrrr' (l - left, r - right) of "Grafs.create_graf()" means that the ant when passin through the same block, goes to the left 3 times and then to the right 3 times.

Try changing the parameter and see the results.

Parameter pattern
'rlr' Chaos
'llrr' Symmetrical
'lrrrrrllr' Square
'llrrrlrlrllr' Concoluted

More

About

A viewer of Langston's Ant

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages