From 7abdccd59f1bdb831cd2a8f6c92ad1e99f2eb5de Mon Sep 17 00:00:00 2001 From: yuzu-eva Date: Mon, 11 Nov 2024 18:20:58 +0100 Subject: finished maze solver --- main.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'main.py') diff --git a/main.py b/main.py index 56f0817..8c88d7e 100755 --- a/main.py +++ b/main.py @@ -3,6 +3,8 @@ from graphics import Window from maze import Maze +import sys + def main(): num_rows = 12 num_cols = 16 @@ -11,9 +13,17 @@ def main(): screen_y = 600 cell_size_x = (screen_x - 2 * margin) / num_cols cell_size_y = (screen_y - 2 * margin) / num_rows + + sys.setrecursionlimit(10000) win = Window(screen_x, screen_y) maze = Maze(margin, margin, num_rows, num_cols, cell_size_x, cell_size_y, win) + print("maze created") + is_solvable = maze.solve() + if not is_solvable: + print("cannot solve maze") + else: + print("maze solved") win.wait_for_close() -- cgit v1.2.3