nwallace / langtons-ant

An implementation of Langton's Ant in Clojure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Langton's Ant

This is a Clojure/Clojurescript implementation of Langton's Ant.

How to run the program in the terminal

You may specify rules for up to 9 colors using "R" to indicate a right turn and "L" to indicate a left turn.

You can run the first 100 steps with Langton's original rules like this:

lein run -- RL --steps 100

Which will produce output like this:

Example output

Additionally, you can adjust the speed of the simulation by providing the amount of time to pause between each step (in milliseconds).

Full usage

lein run -- <rules> --steps <steps> [--interval <msec>]

How to run the program in a browser

Start the file server:

lein figwheel

Then visit http://localhost:3449

How to run the tests

The project uses Midje.

lein midje will run all tests.

Credits

Ant image created by Lele Saa of The Noun Project, Creative Commons License 3.0.

About

An implementation of Langton's Ant in Clojure

License:Other


Languages

Language:Clojure 92.0%Language:CSS 5.9%Language:HTML 2.2%