From c981f127ed42c2c373872d221fe4eab7c3f036d0 Mon Sep 17 00:00:00 2001
From: Patricia Aas <patricia@turtlesec.no>
Date: Tue, 19 Oct 2021 10:08:41 +0200
Subject: [PATCH] Create is_valid_move_simple

---
 .../25/pacman_ai/solution/is_valid_move_simple      | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 exercises/25/pacman_ai/solution/is_valid_move_simple

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;
+}