diff --git a/exercises/25/pacman_ai/solution/is_valid_move_simple b/exercises/25/pacman_ai/solution/is_valid_move_simple new file mode 100644 index 0000000..d10c7d1 --- /dev/null +++ b/exercises/25/pacman_ai/solution/is_valid_move_simple @@ -0,0 +1,13 @@ +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; +}