Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Langton's ants

Name: Anonymous 2012-02-18 21:45

http://pastebin.com/eAyjYV1f

I know it's horridly ineficient but I'm having to must fun playing with it to do anything about it.

Have fun

Also, it's called ``Improved langton's ants'' because this is a more modular version of one I made earlier.

Name: Anonymous 2012-02-18 22:06

Langton's anus

Name: Anonymous 2012-02-19 5:40

WHY ARE YOU DESTROYING ANTS?

Name: Anonymous 2012-02-19 5:55

>>3
It is the only way to free them.

Name: Anonymous 2012-02-19 6:12

>>4
Free them from their mortal coil?

Name: Anonymous 2012-02-19 6:21

>>5
It is a cruel world.

Name: Anonymous 2012-02-19 10:50

steps = 10500
lattice = {}
x, y = 0, 0
dx, dy = -1, 0
xmin, xmax = -30, 30
ymin, ymax = -30, 30

for i in range(steps):
    # Flip value
    value = lattice.get((x, y), False)
    lattice[x, y] = not value
   
    # Turn and move
    dx, dy = (dy, -dx) if value else (-dy, dx)
    x, y = x + dx, y + dy

for y in range(ymin, ymax):
    out = []
    for x in range(xmin, xmax):
        value = lattice.get((x, y), False)
        out.append('  ' if value else '[]')
    print ''.join(out)


Why are you using an inferior programming language?

Name: Anonymous 2012-02-19 13:09

>>7
You insensitive bastard.

Don't change these.
Name: Email:
Entire Thread Thread List