Ex 25: Implement isValidMove().

This commit is contained in:
Dag-Erling Smørgrav 2021-10-19 09:48:30 +02:00
parent 4b58b4115c
commit b97e1c6f2c

View file

@ -27,8 +27,8 @@ GridPosition PacManAI::pelletClosestToPacman(GridPosition position,
// This function is not yet implemented.
// You will implement it as part of module 25.
bool PacManAI::isValidMove(const Move &) {
return false;
bool PacManAI::isValidMove(const Move & move) {
return isWalkableForPacMan(move.position) && move.direction != oppositeDirection(direction);
}
// This function is not yet implemented.