Category: Programming

  • Langton’s Ant 3D, Version 1

    Langton's Ant in 3D space

    Click here to see the ant in new amazing 3D action.

    My first attempt at moving Langton’s Ant into a 3D grid. The 3D part was easy – just add some Z movement to the existing X and Y pattern.

    This is what you are looking at: there are 100 cells in the X (left and right) and Y (up and down) plane, and 25 in the Z (toward and away from the viewer) plane. There is one bitmap for each Z level, making for 25 stacked bitmaps. The bitmap in which the ant is currently moving is set at 100% opacity, with the surrounding bitmaps becoming increasingly opaque until they are almost transparent. When the experiment seems to flicker, it is because the ant is rapidly switching between Z levels. Those long horizontal “roads” the ant makes are probably more like tubes when viewed in 3D space.

    Making the ant move in an interesting pattern is a little more difficult. In 2D (X,Y) space, from each point the ant can either turn left or right, and move forward one space, depending on the state of the cell to which the ant moves. That means, using initial conditions, the ant will move in a perfect square: up 1, left 1, down 1, right 1, and end up back at the original square. In order for me to make that work in 3D space, the ant must visit each of eight cells, forming a cube, and return to the original cell without doubling back on itself. The current experiment does not do that, thus the long horizontal runs.

    Right now there are 18 rules for the ant’s movements. Each of these rules is iterated through, based on the color of the cell on which the ant lands. Landing on an “off” cell causes the ant to move according to the next rule. Landing on an “on” cell causes the ant to move according to the previous rule. If I implement multiple “on” colors, then I can cut the movement rules down to 6, but I will need to have each rule account for the color of the cell in which the ant currently resides.

    Look for more iterations on this problem in days to come.

  • Langton’s Ant – Hex pattern

    Langton's Ant - 6

    Click here to see it running.

    Mostly similar to the previous Langton’s Ant experiment, this one uses a hexagon-ish algorithm instead of a quad. Because I am using square pixels to draw the results, it isn’t precisely a hexagon, but it is close enough to get the point across. Actually, the “ant” view is quite a bit more interesting than the heatmap view.

    Click the Flash movie to toggle between the views.

  • Langton’s Ant with Heat Map

    Langton's Ant Heat Map

    Click here to see it in action.

    This is an update to the previous Langton’s Ant experiment. For this one I have added a heat map which shows the frequency with which the “ant” visits each cell in this grid. The more visits to a cell, the “hotter” the color. Click the application to toggle between the ant view and the heat map view.

    I am really enjoying playing around with this thing. I have “hex” and “oct” variations (the above is a “quad”) waiting in the wings, and am exploring what it will take to make a 3d version, which hopefully I will have done this weekend.

  • Langton’s Ant, Reboot

    Langton's Ant

    Click here to run the ants.

    Another Cellular Automaton experiment. The rules for this one work as follows:
    0. Place an ant on a grid.
    1. check the color of the square the ant is on.
    2a. If the square is red, turn it black and turn to the left.
    2b. If the square is black, turn it red and turn to the right.
    3. Move forward one square and repeat.

    No interaction here; it will do the same thing every time you visit.

    If you are patient, some interesting things begin to happen around iteration 10,000.

  • Automata I

    Cellular Automaton

    Click here to run the automata.

    Once upon a time I did something like this, maybe back in 2003 or 2004. I recently re-arranged my bookshelves and discovered my copy of A New Kind of Science by Stephen Wolfram. So now I have caught the CA bug.

    Click the application to reset it. More interaction will be coming soon.

  • Weekly Gyruss Update

    Gyruss-like Flash game

    The weekly Gyruss update. Click here to play around.

    Another update – this one focusing more on graphics. I really think the rotating background adds something, but to make it look good I had to mask it to a circle in the center, and that seems to ask for a groovy border of some kind. Yeah, definitely a groovy border.

  • New Gyruss Update

    Gyruss clone in Flash Actionscript 3

    An update concentrating on some gameplay mechanics, mostly optimizing for speed and playing around with the effects of power-ups; specifically, allowing the player to fire multiple shots. Arrow keys move left and right, space bar shoots. Click the image to launch the game.

  • All Alike

    Procedurally generated maze in Actionscript 3

    Click here to launch the maze explorer.

    I have combined two of my experiments into something greater than the sum of the parts. Or at least, pretty close to equal to the sum of the parts. The height map explorer from a couple of weeks ago, combined with the maze from a few days ago. The combining took me all of ten minutes.

    Now that I have got this far, I next need to start playing with collision detection so players can navigate the mazes, instead of flying over them.

    A more technical description of this experiment can be found on my GameDev blog

  • aMazeIng!

    A generated maze. Click the image to play.

     

    Sorry for the title; I couldn’t help myself.

    I took the Java code from the Wikipedia article on Maze Generation Algorithms, converted it to Actionscript, and Voila! A randomly generated maze of practically infinite variations. For all intents and purposes it is just an image at the moment, but I will soon add wall detection and turn it into a game of some kind. Click anywhere on the maze to generate a new one.

  • Some Improvements

    Gyruss Clone in Flash and Actionscipt 3

    An update to the game. Click the screenshot to see it in action.

    Still very rough, but playable for the moment. Arrow keys to move clockwise/widdershins, and SPACE to fire.