pacman/exercises/25/pacman_ai/solution/is_valid_move_simple

14 lines
284 B
Text
Raw Normal View History

2021-10-19 08:08:41 +00:00
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;
}