All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pacman.controllers.examples.RandomNonRevPacMan Maven / Gradle / Ivy

There is a newer version: 2.0.1.0
Show newest version
package pacman.controllers.examples;

import java.util.Random;

import pacman.controllers.Controller;
import pacman.game.Game;

import static pacman.game.Constants.*;

/*
 * The Class RandomNonRevPacMan.
 */
public final class RandomNonRevPacMan extends Controller {
    Random rnd = new Random();

    /* (non-Javadoc)
     * @see pacman.controllers.Controller#getMove(pacman.game.Game, long)
     */
    public MOVE getMove(Game game, long timeDue) {
        MOVE[] possibleMoves = game.getPossibleMoves(game.getPacmanCurrentNodeIndex(), game.getPacmanLastMoveMade());        //set flag as false to prevent reversals

        return possibleMoves[rnd.nextInt(possibleMoves.length)];
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy