pacman.controllers.examples.RandomPacMan Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pacman-main Show documentation
Show all versions of pacman-main Show documentation
The main code for Ms. Pac-Man Vs Ghosts
package pacman.controllers.examples;
import pacman.controllers.PacmanController;
import pacman.game.Constants.MOVE;
import pacman.game.Game;
import java.util.Random;
/*
* The Class RandomPacMan.
*/
public final class RandomPacMan extends PacmanController {
private Random rnd = new Random();
private MOVE[] allMoves = MOVE.values();
/* (non-Javadoc)
* @see pacman.controllers.Controller#getMove(pacman.game.Game, long)
*/
@Override
public MOVE getMove(Game game, long timeDue) {
return allMoves[rnd.nextInt(allMoves.length)];
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy