GridWorld – v1.0

My second assignment was to create a pathfinding program called GridWorld, not unlike an old AP Case Study.

User Interface

Again my first priority was the interface. Using the trusty library StdDraw, I used the same sort of grid pattern that I used in my Game of Life program. This time, by using images to form the grid instead of individual rectangles, I didn't have to worry about borders between the cells or any other extra buffer. The final UI can be seen in the picture. 


However, this time, instead of creating buttons on the canvas itself, I opted to use Swing, the GUI toolkit included in Java. This helped me create buttons and a "Control Panel" (right), which was much easier than using StdDraw's graphics and listening for a mouse click.
The Game

As we are learning about Agents in my Artifical Intelligence class, this project contains an Agent, which is the player. The Agent loops through three phases: sense, decide, and act. In Gridworld, the Player agent senses which paths are open and which are blocked, decides which way it should go based on that information, and finally acts by moving to the appropriate cell. 

GridWorld's rules are simple. First, the player builds a maze made of bricks and roads. Keep in mind that when building, the road pathways must be at least two blocks wide. After building a maze, the player can add/remove players (a green circle) and exits (a blue square), and can also reset cells to their default states (roads for most, walls for the outer border). See the picture below for an example maze.


After that, the player clicks go and then the program runs. The game finishes when a player (the green circle) finds an exit. 

Future Improvements

Although I am proud of this project, I believe there is definitely room for improvement. Updating the graphics for the players and exits could be a great benefit. Also, giving the user more preferences for the game would be great. For example, the user could choose which way the player moves through the maze (left or right); the textures (sprites) for the players; and whether all players, or just one of them, needs to exit to finish the game.

Additionally, I think it would be neat to add a "battle mode", where players fight each other if they are in close proximity to each other in the maze. 

Download

(coming soon, still trying to figure out where to host these files)

Comments

Popular updates

Half Moon Project Part 2 - More Accuracy

NumberVision – Machine Learning Application

Machine Learning & Half Moon Project