diff --git a/Game_Development/Maze/Maze.py b/Game_Development/Maze/Maze.py
new file mode 100644
index 00000000..5f6226a6
--- /dev/null
+++ b/Game_Development/Maze/Maze.py
@@ -0,0 +1,193 @@
+import random
+import ipywidgets as widgets
+from IPython.display import display, clear_output, HTML
+import time
+
+def generate_maze(size):
+ maze = [["#" for _ in range(size)] for _ in range(size)]
+
+ def carve_passages(x, y):
+ directions = [(0, 2), (2, 0), (0, -2), (-2, 0)]
+ random.shuffle(directions)
+ for dx, dy in directions:
+ nx, ny = x + dx, y + dy
+ if 1 <= nx < size - 1 and 1 <= ny < size - 1 and maze[nx][ny] == "#":
+ maze[x + dx // 2][y + dy // 2] = " "
+ maze[nx][ny] = " "
+ carve_passages(nx, ny)
+
+ maze[1][1] = " "
+ carve_passages(1, 1)
+ maze[size - 2][size - 2] = " "
+
+ for _ in range(size // 2):
+ x, y = random.randint(1, size - 2), random.randint(1, size - 2)
+ if maze[x][y] == " ":
+ maze[x][y] = "#"
+
+ return maze
+
+def print_maze(maze, player_position):
+ output = ""
+ for i, row in enumerate(maze):
+ line = ""
+ for j, cell in enumerate(row):
+ if (i, j) == player_position:
+ line += "๐ง"
+ else:
+ line += "{}".format(cell)
+ output += line + "
"
+ return output
+
+class MazeGame:
+ def __init__(self):
+ self.size = 0
+ self.maze = []
+ self.position = (1, 1)
+ self.exit_point = None
+ self.move_limit = 0
+ self.move_count = 0
+ self.user_path = []
+ self.desired_path = []
+ self.output_widget = widgets.Output()
+ self.start_game()
+
+ def start_game(self):
+ clear_output(wait=True)
+ print("๐ฎ Select difficulty level: ")
+ print("1. Intermediate (11x11)")
+ print("2. Hard (15x15)")
+ print("3. Very Hard (21x21)")
+
+ self.difficulty_dropdown = widgets.Dropdown(
+ options=['1', '2', '3'],
+ description='Difficulty:',
+ )
+ self.start_button = widgets.Button(description="Start Game")
+ self.start_button.on_click(self.set_difficulty)
+
+ display(self.difficulty_dropdown, self.start_button, self.output_widget)
+
+ def set_difficulty(self, b):
+ if self.difficulty_dropdown.value == '1':
+ self.size = 11
+ self.move_limit = 20
+ elif self.difficulty_dropdown.value == '2':
+ self.size = 15
+ self.move_limit = 30
+ else:
+ self.size = 21
+ self.move_limit = 40
+
+ self.maze = generate_maze(self.size)
+ self.exit_point = (self.size - 2, self.size - 2)
+ self.position = (1, 1)
+ self.move_count = 0
+ self.user_path = []
+ self.desired_path = self.calculate_desired_path()
+
+ self.play_game()
+
+ def calculate_desired_path(self):
+ from collections import deque
+
+ queue = deque([(1, 1, [])])
+ visited = set()
+ visited.add((1, 1))
+
+ while queue:
+ x, y, path = queue.popleft()
+ if (x, y) == self.exit_point:
+ return path
+
+ directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]
+ for dx, dy in directions:
+ nx, ny = x + dx, y + dy
+ if (0 <= nx < self.size and 0 <= ny < self.size and
+ self.maze[nx][ny] == " " and (nx, ny) not in visited):
+ visited.add((nx, ny))
+ queue.append((nx, ny, path + [(nx, ny)]))
+
+ return []
+
+ def play_game(self):
+ clear_output(wait=True)
+ self.start_time = time.time()
+ with self.output_widget:
+ display(HTML("