As algorithms become increasingly complex and abstract, understanding the logic behind them grows increasingly difficult for many students. In an effort to help facilitate this understanding for future students enrolled in Penn's Artificial Intelligence course, Dr. Chris Callison-Burch and I have worked to create a video game-inspired visualization of many of the classic search algorithms that are covered in the class.
In our attempts to create a visual simulation of popular pathfinding algorithms, aside from the algorithms themselves, I have learned how to model a game board as a graph, allowing a player to move across tiles represented by nodes. A simple mouse click to move now involves a call to my implementation of the A* algorithm. A* determines the optimal path to reach a destination in as short a distance as possible. I wrote a random maze generation algorithm based on Depth First Search. This means that the layout of a room can now change each time the room is entered, walls placed according to the random configuration returned by the algorithm. In fact, the four different algorithms used to move around the game are only the start of how the program can be used.
With this program, students of the course can re-implement the algorithms themselves and watch their character move on the screen, immediately allowing them the ability to check if their algorithm behaves as intended. The algorithms are implemented such that the tiles on the floor change colors as the algorithm explores each direction, highlighting which tiles are considered and which are ultimately determined to be part of the solution path.
Visualizing search algorithms in a video game allows for a fun and interactive method of programming, but also for students to truly understanding each step of many popular algorithms in general, even those beyond the scope of this course. Looking forward towards future educational experiences, I see these tools as being extremely beneficial in my efforts to grow as a software engineer, allowing me the ability to debug my work effectively and program efficiently.