Hacker Newsnew | comments | show | ask | jobs | submit login

Another fun example of a computer generating mezmerizingly complex art from simple code is that as a kid, I wrote a Langton's Ant implementation in QBASIC on a DOS machine (don't remember the version). IIRC this was using Graphics Mode 1 (320 x 200 pixel framebuffer), and I used PSET and PRESET to draw white and black pixels. This so far sounds ordinary but:

The cool thing was that I forgot to write the bounds check to make sure the ant stayed inside the framebuffer! So the ant would happily trundle off-screen, encounter arbitrary bits that were in that memory, and would often eventually return back on the screen from a different location. Or sometimes (probably due to encountering zeros offscreen) it would run a lap around the edge of the screen and then veer back inward.

Langton's Ant: http://en.wikipedia.org/wiki/Langtons_ant




I had the same bug (no pun intended), but in JavaScript. It does produce some interesting effects after making a few laps.

http://chengsun.github.com/walk.html

I still am a "kid", and it amuses me that I'm making the same stuff on modern platforms that have already been done on DOS machines by kids like me.

-----


Awesome!! Glad you were able to reproduce the effect! :D

-----


Reminds me of this blog post about a Tron game that didn't check memory bounds either: http://blog.danielwellman.com/2008/10/real-life-tron-on-an-a...

-----




Guidelines | FAQ | Support | API | Lists | Bookmarklet | DMCA | Y Combinator | Apply | Contact

Search: