changed some magic numbers to constants

This commit is contained in:
Lizzy
2024-03-24 21:38:44 -05:00
parent 642a66b14b
commit 6797c91432

View File

@@ -208,8 +208,11 @@ class Board:
node.draw(screen) node.draw(screen)
def main(): def main():
BOARD_DIMENSIONS = XYPair(100, 80)
WALL_DENSITY = 0.45
render_info = Render_Info() 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) screen = pygame.display.set_mode(render_info.screen_dimensions)
running = True running = True
evolving = False evolving = False
@@ -224,7 +227,7 @@ def main():
if evolving: if evolving:
if not board.explore(): if not board.explore():
pygame.time.wait(5000) 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(): for event in pygame.event.get():
if event.type == pygame.QUIT: if event.type == pygame.QUIT:
@@ -235,7 +238,7 @@ def main():
evolving = not evolving evolving = not evolving
if event.key == pygame.K_ESCAPE: 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__": if __name__ == "__main__":
main() main()