From 6797c91432710a0fd906c550e1e4b242cb33d837 Mon Sep 17 00:00:00 2001 From: Lizzy <=> Date: Sun, 24 Mar 2024 21:38:44 -0500 Subject: [PATCH] changed some magic numbers to constants --- astar.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/astar.py b/astar.py index e48ed0a..03bd15a 100644 --- a/astar.py +++ b/astar.py @@ -208,8 +208,11 @@ class Board: node.draw(screen) def main(): + BOARD_DIMENSIONS = XYPair(100, 80) + WALL_DENSITY = 0.45 + render_info = Render_Info() - board = Board(XYPair(100, 80), 0.45, render_info) + board = Board(BOARD_DIMENSIONS, WALL_DENSITY, render_info) screen = pygame.display.set_mode(render_info.screen_dimensions) running = True evolving = False @@ -224,7 +227,7 @@ def main(): if evolving: if not board.explore(): pygame.time.wait(5000) - board = Board(XYPair(100, 80), 0.45, render_info) + board = Board(BOARD_DIMENSIONS, WALL_DENSITY, render_info) for event in pygame.event.get(): if event.type == pygame.QUIT: @@ -235,7 +238,7 @@ def main(): evolving = not evolving if event.key == pygame.K_ESCAPE: - board = Board(XYPair(100, 80), 0.45, render_info) + board = Board(BOARD_DIMENSIONS, WALL_DENSITY, render_info) if __name__ == "__main__": main() \ No newline at end of file