Game of Life in AS3

My entry for the Phlashers 5kb Code as Art contest. It’s a Game Of Life implementation written in less than 5kb lines of code. Click on cells to toggle. Press any key to play/pause the simulation.

Advertisements

Remember that AI game you were working on?

Back when I was still in school, a professor advised us to createa code repository. Sure you might find your old programs stupid and badly written but within those old crappy code you might find something of value. Come to think of it, this is one of the reasons why I made this blog.

While working on the Biomodd game, I stumbled upon an old project of mine. It was a java based simulation platform for implementing bot behavior. I started coding it a few weeks after graduation fresh from my immune algorithms thesis. The algorithm bit of the thesis was interesting but I was more curious at how I can extend the system so that I can easily swap algorithms without changing much of the code. I didn’t know it then but I was actually trying to design a framework. Like most of my “ventures”, I eventually had to freeze the project after I dug into “flocking algorithms” and totally messed up the physics part. I was at my hometown with no internet and no physics or math book so I had to rely on stock knowledge for pretty much everything.

My OOP and design pattern skills were limited but the code came in handy when I was studying for an IT-certificate course (don’t ask J). We were required to present a game that utilizes OOP concepts. I revived the project, added a few sprites, simplified the movement algorithms (to a simple linear Point A to Point B movement), added a few if-else conditions then presented the “game” to our class the next day.

It was almost a year since I last touched the code and had to download JCreator in order to open the project file. Going back to JCreator after my experience with NetBeans and Eclipse made me wonder at how simple my programming needs were back in college. No code-complete, no SVNs, no build or debug tools, no refactoring.

Everything was so simple. I looked over my code and saw stupid OOP mistakes. Bad use of inheritance here, bloated classes there. I searched for the movement logic and, thanks to the code comments of my old self, easily found it and toyed with it once more.

I guess maybe I need to create a google code account or something, just to have something to put all the past codes/garbage in. Ok I’ll do that, as soon as I have broadband access.