pacman.controllers.MASController 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;
import pacman.entries.ghostMAS.Blinky;
import pacman.entries.ghostMAS.Sue;
import pacman.entries.ghostMAS.Inky;
import pacman.entries.ghostMAS.Pinky;
import pacman.game.Constants.*;
import pacman.game.Game;
import java.util.EnumMap;
/**
* Created by Piers on 11/11/2015.
*
* Makes the game PO for each controller
*/
public final class MASController extends Controller> {
private EnumMap myMoves = new EnumMap(GHOST.class);
private EnumMap controllers = new EnumMap<>(GHOST.class);
public MASController(EnumMap controllers){
this.controllers = controllers;
}
@Override
public final EnumMap getMove(Game game, long timeDue) {
myMoves.clear();
for (GHOST ghost : GHOST.values()) {
myMoves.put(ghost, controllers.get(ghost).getMove(game.copy(ghost), timeDue));
}
return myMoves;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy