Gator PacMan (2020)
Gator PacMan (2020)
Play the classic PacMan game but with a fun twist! You play as the UF Gator, and the ghosts are UF's rival football teams!
Created in IntelliJ IDEA; Coded in Java
Can be played manually. However, I also coded the computer to play and achieve the highest possible score through a series of complex algorithms.
In this video, I am playing the Gator PacMan game myself.
In this video, the computer is playing the Gator PacMan game with absolutely no input or control from a user.
Computer-Playing Algorithm
If you follow along with the diagram on the right, you will see a simplified explanation of the algorithm that the computer follows in order to play the game by itself.
Power Pill & Defenders
When the computer is going towards a Power Pill, it will stall and wait until a defender is close by before taking it. This way, it takes the Power Pill right before the defender reaches the computer so that the defender may then become vulnerable and the computer can attack it. I have programmed it this way since attacking defenders when they are vulnerable provides a significant score boost.
Once the Power Pill has been activated, the computer will go towards the closest defender.
To Attack or Not to Attack?
If all defenders are not vulnerable, meaning that the computer did not just activate a Power Pill, it will consider multiple options before taking a path.
If the closest Power Pill is less than 3 spots away, it will then determine if the closest defender is more than 6 spots away. If it is, then the computer will go after the regular pills so as to not waste a Power Pill when it could be used to a greater advantage. If the defender is less than 6 spots away, then the computer will go towards the Power Pill and then attack the defender.
If the closest Power Pill is more than 3 spots away, the computer will then determine if the distance between the closest defender and the computer is less than 15. If it is, it will then either go after the defender if it is vulnerable, or determine if the distance to the closest power pill is smaller than the distance to the closest defender and subsequently either go after the Power Pill or run away from the defender.Â
If the distance between the computer and the defender is between 15 and 30, then the computer will either go after the defender if it is vulnerable or go after the regular pills if not.
If the distance between the computer and the defender is more than 30, then the computer will either go after a vulnerable defender, go after a Power Pill if it is closer than the nearest defender, or otherwise go after regular pills.
On average, the computer's score playing Gator PacMan was 9,853.
Think you can do better? If you would like to play, you can click on the link to the left and follow the install instructions.