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

pacman.controllers.MASController Maven / Gradle / Ivy

There is a newer version: 2.0.1.0
Show newest version
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