package ch.epfl.maze.physical.pacman; import ch.epfl.maze.physical.Animal; import ch.epfl.maze.physical.Daedalus; import ch.epfl.maze.physical.Prey; import ch.epfl.maze.physical.stragegies.picker.RandomPicker; import ch.epfl.maze.physical.stragegies.reducer.BackwardReducer; import ch.epfl.maze.util.Direction; import ch.epfl.maze.util.Vector2D; import java.util.Set; /** * Pac-Man character, from the famous game of the same name. * * @author EPFL * @author Pacien TRAN-GIRARD */ public class PacMan extends Prey implements BackwardReducer, RandomPicker { /** * Constructs a new Pac-Man. * * @param position Starting position of the Pac-Man in the Daedalus */ public PacMan(Vector2D position) { super(position); } @Override public Direction move(Set choices, Daedalus daedalus) { Set smartChoices = choices.size() > 1 ? this.reduce(choices) : choices; return this.pick(smartChoices); } @Override public Animal copy() { return new PacMan(this.getPosition()); } }