Ex 25: Implement isValidMove().

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

View file

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