changed some magic numbers to constants
This commit is contained in:
9
astar.py
9
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()
|
||||
Reference in New Issue
Block a user