pacman/exercises/25/pacman_ai/solution/is_valid_move_simple
2021-10-19 10:08:41 +02:00

13 lines
284 B
Text

bool PacManAI::isValidMove(const Move & move) {
const bool isOpposite = (move.direction == oppositeDirection(direction));
if (isOpposite) {
return false;
}
const bool canWalk = isWalkableForPacMan(move.position);
if (!canWalk) {
return false;
}
return true;
}