PDA

View Full Version : 'Langton's Ant' - Maths Fun


H3LL
13th July 2005, 06:05 AM
I'm to mathematics what Einstein is to plumbing.

That said, I was reading some time ago a Terry Pratchett book that mentioned a simple ant algorithm and today went googling and found Langton's Ant.

The Rules:

1 - Turn:
(a) - If the ant is on a white square, turn right.
(b) - If the ant is on a black square, turn left.
2 - Switch the color of the ant's current square.
3 - Move forward one square.

I find these programs fascinating and offer them for anyone that wants to waste an hour or two playing with them or just to find out what they are.

This is an interesting one as you can add more options.

Langton's Ant (http://www.math.umd.edu/~wphooper/ant/applet.html)

His main page is worth a visit as it has some other similar stuff he's worked on.

Pat's Mathematics Website (http://www.math.umd.edu/~wphooper/)

Another Langton's Ant program with a twist:

Another Ant (http://users.libero.it/acnard/ant.html)

Have fun.


:D

Donks
13th July 2005, 06:16 AM
Another one you can try:
1) Draw an equilateral triangle.
2) Pick a point at random (inside or outside, doesn't matter)
3) Pick one of the vertices of the triangle at random
4) At the midway point between the point and the vertex, put a point.
5) Use that new point and repeat 3-5 to taste.

Or...
1) Start with Pascal's Triangle.
2) Change all numbers on the triangle (up to the level you calculated) for their parity (1 for odd, 0 for even)
3) Change the 1 to a black dot, and the 0 to a white dot.

Either way you end up with the Sierpinski Triangle (http://serendip.brynmawr.edu/playground/sierpinski.html)