The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

Weird Program of the Day by williamashbless 2006-10-26 16:10:46
1) Write a program to implement Langton's Ants
2) Try to find an initial state of the grid that does not cause it to _eventually_ produce the same diagonal march behaviour.

Langton's Ants is generated thusly:

Start with a grid of cells filled with either 1's or 0's (or * and space, or any two values). The grid is effectively infinite in all directions, so any nonexplicit cells should be 0 (or space)).

Start the ant at any cell. (represented by a coordinate). Face it any direction (represented by one of the four cardinal directions).
Loop
   move ant forward
   if the ant finds a 0, turn it into a 1, and turn left
   elif the ant finds a 1, turn it to a 0, and turn right
   fi
Pool

Watch the pattern as the ant marches around! (display the grid to do this, every tick).

Eventually, Langton's Ant will get into a repeating pattern... even if you pre-populate the grid with random noise or interesting patterns. Until it does, it makes pretty pictures for you.

Do it with black and white pixels for larger tests and get neat bitmaps!

[ Reply ]
  I have no idea. by MrTrick2006-10-26 16:15:13
    Or a hex grid for tha matter... by williamashbless2006-11-19 12:55:59
  Proving you had succeeded would be difficult. by Arachnid2006-10-26 16:19:56
    Okay, fine, nitpicker. :D by williamashbless2006-10-26 16:22:41
  Done. by shadowsystems2006-11-19 12:55:59
    It does not. Fibber. :D (n/t) by williamashbless2006-10-26 16:22:59
      What, he program? (n/t) by theanomaly2006-10-26 16:25:35
        Neener neener, Made ya look! =)P by shadowsystems2006-10-26 16:28:36
          *gives you a _wet_ paper bag then* (n/t) by williamashbless2006-10-26 16:31:20
            (Looks at it, takes it, and... by shadowsystems2006-10-26 16:37:01
          I avoid programming like the plague. by theanomaly2006-10-26 16:31:49
            Good thing, too! by shadowsystems2006-10-26 16:36:14
              :D Thanks, needed a grin. by theanomaly2006-10-26 18:07:10

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)