Monday, November 3, 2008

A* for ActionScript

For my class titled "Artificial Intelligence for Video Games" I have been working on an implementation of the algorithm A* in ActionScript. I've been pretty happy that the professors allow us to use ActionScript, instead of Processing, because it makes sharing my work on the Internet much easier. In addition, I think having substantial ActionScript skills is a marketable quality, as opposed to skills in the programming language "Processing." Hopefully I also will develop skills in artificial intelligence, to transcend any of the language-specific focuses I may have in mind.

As of this post, I have no actually implemented A* in ActionScript. What I have done is to implement a mechanism to draw and manipulate a relatively straighforward graph. This graph has the edges layed out in a regular, rectangular, pattern.

Here is a SWF of what I have so far:

Click to block/unblock a node, and press space bar to alternate between different modes of selecting a node. Eventually, the blue square will be for the starting position, and the green square will be for the ending position. Once I finish implementing A*, the path between start and end will be drawn in red squares.

Most likely if you are reading about my implementation of A* in ActionScript, you are interested in seeing my code. At this point, the most interesting thing will be how I keep track of adjacency lists for each node.

I will make another post when I finish everything, but I like making things available as I work so I can view my own progress. Here is a .zip of all the files for my project so far. I ask that if you use them, please somewhere link to my blog and email me so I can get some satisfaction.

No comments: