The Final Project for COP3502, “GatorRaider” is a game whose play and levels are based on Ms. Pac-Man. In this game, four defender characters (gators) attempt to limit the damage by an attacker character (hunter).
In this game, the attacker is attempting to cover as much of the terrain as possible, while the defenders attempt to limit the terrain covered by the attacker. The play occurs in two distinct modes: Normal and Vulnerable.
In Normal Mode, the attacker tries to cover terrain while avoiding the defenders. If any defender reaches the attacker, the attacker dies and loses a life, starting at the initial location once again.
If the attacker reaches a power pill, the mode changes for a limited time to Vulnerable Mode. In Vulnerable Mode, if the attacker reaches any defender, the defender will die and its “soul” will return to the lair, where it will regenerate. Each power pill, once consumed, is gone until the level changes.
For every new location the attacker reaches, the attacker will score points. In addition, attacker receives a bonus for reaching the power pills and for killing defenders. The goal of defenders is to limit the score of the attacker.
This code base makes use of the Model-View-Controller (MVC) software pattern. In this application, the interfaces in the game.models package define the format and arrangement of information about the game state. The game start is displayed to the user via the GameView class, which draws the game level and game actors to the screen. The behavior of the actors is determined by implementations of the AttackerController and DefenderController, whose actions change the how the game plays out.
All work was done in the custom controller src/ufl/cs1/controllers/StudentController
. The goal was to beat the score of the benchmark agent, Devastator, on average over 100 tests. This goal was acheived with the Devastator benchmark scoring 6980.4 and the StudentController algorithm scoring 6133.7. This was using Java version 1.8 on IntelliJ IDEA Version 2017.2.2
ghostLovelace was the simplest ghost in the program and its main function was to be a chaser. This ghost’s strategy was to run away from pac man if it was vulnerable and there was not enough distance between itself and pacman. This was because if ghostLovelace was at a completely different part of the map when vulnerable, it should not have to run away from pacman unless he got close enough. If these conditions were not met, ghostLovelace would go towards pacman to try and catch him. Since ghostLovelace is not as fast as pacman so it would not be able to catch him on its own, ghostLovelace relies on the other ghosts to catch pacman from a different direction.
ghostHopper has a strategy that is very similar to ghostLovelace’s strategy. However, ghostHopper has some added functionality. ghostHopper will also run away from pac man if it was vulnerable and there was not enough distance between itself and pacman. This ghost will also check to see if pacman is a small distance away from an active powerpill in which case it will run away. If these conditions are not met, ghostHopper will try to catch pacman. ghostHopper’s main function like ghostLovelace is to be a chaser. They work together to catch pacman since neither are fast enough. The goal is to have them come from different directions and trap pacman.
ghostFierroz’s function was to guard available power pills at the top of the map and chase after pacman if he got within a shortest path of 10 nodes from the ghost. Also a check would be run to see if pacman was right behind the ghost, if then the direction of the ghost would invert, thereby catching him. When there were four powerpills on the map and if pacman was in the bottom half of the screen, ghostFierroz was to guard the top right powerpill. If pacman was in the top half of the screen, then Fierroz would guard the top left power pill. When there were three powerpills left and pacman was in the top half of the screen, a test was carried out to see if both the top left and bottom left powerpills were still available. If so, Fierroz would guard the top left. If not, an individual check was completed to see which power pill was present. If it was the top left (checked first), both ghosts would guard it. If it was the bottom left (checked last), they would guard that one. If they were both present then the default would be to guard the top left. If pacman was in the bottom half of the screen, a check was carried out if the top and bottom right powerpills were present. If they were Fierroz would guard the top right. If the top and bottom pills check failed, it was checked to see if the top right pill was present. If so, then Fierroz would guard it. If not, then he would go to the bottom right. When there were two pills left, a test was given to see if the left pills were both present. If so, Fierroz would guard the top left. If not, it was checked to see if both right pills were present. If so, then Fierroz would guard the top right powerpill. If both the left pills weren’t present at the same time, and if both the right pills were not present at the same time a test was run to see which half of the map pacman was in. If he was in the top half, it was checked to see if the top left powerpill was present. If so, then both guards would go protect it. If not, they would both go guard the bottom right pill. If pacman was in the bottom half of the map, it was checked to see if either the top left or the bottom left pill was present. If the top left was, then they would both go guard it, if not then they would go to the bottom left. When there is only one powerpill left, a check is run to determine which one it is. Then Fierroz will go and guard it. Once all powerpills are gone, Fierroz starts chasing pacman around until either the game is over, or pacman gets to the next level.
ghostMikeyMike’s function was also to guard available power pills and chase after pacman if he got within a shortest path of 10 nodes from the ghost. Also a check would be run to see if pacman was right behind the ghost, if then the direction of the ghost would invert, thereby catching him. The only difference between ghostMikeyMike and ghostFierroz is that ghostMikeyMike was designed to guard the bottom pills when they were available, while ghostFierroz was supposed to guard the top pills when they were available. Although when running the code, it was determined that pacman started at the bottom of the map and worked his way up after getting rid of the two powerpills at the bottom so ghostMikeyMike was the more active of the two guarding ghosts. When there were four powerpills on the map and if pacman was in the bottom half of the screen, ghostMikeyMike was to guard the bottom right powerpill. If pacman was in the top half of the screen, then he would guard the bottom left powerpill. When there were three powerpills left and pacman was in the top half of the screen, a test was carried out to see if both the top left and bottom left powerpills were still available. If so, MikeyMike would guard the bottom left. If not, an individual check was completed to see which power pill was present. If it was the top left (checked first), both ghosts would guard it. If it was the bottom left (checked last), they would guard that one. If they were both present than the default would be to guard the top left. If pacman was in the bottom half of the screen, a check was carried out if the top and bottom right powerpills were present. If they were MikeyMike would guard the bottom right. If the top and bottom pills check failed, it was checked to see if the top right pill was present. If so, then MikeyMike would guard it. If not, then he would go to the bottom right. When there were two pills left, a test was given to see if the left pills were both present. If so, MikeyMike would guard the bottom left. If not, it was checked to see if both right pills were present. If so, then MikeMike would guard the bottom right powerpill. If both the left pills weren’t present at the same time, and if both the right pills were not present at the same time a test was run to see which half of the map pacman was in. If he was in the top half, it was checked to see if the top left powerpill was present. If so, then both guards would go protect it. If not, they would both go guard the bottom right pill. If pacman was in the bottom half of the map, it was checked to see if either the top left or the bottom left pill was present. If the top left was, then they would both go guard it, if not then they would go to the bottom left. When there is only one powerpill left, a check is run to determine which one it is. Then Fierroz will go and guard it. Once all powerpills are gone, MikeyMike starts chasing pacman around until either the game is over, or pacman gets to the next level.