From 68b9a117e03c6f64d1f15280a0ec61824d25ced6 Mon Sep 17 00:00:00 2001 From: Peter Ward Date: Wed, 28 Oct 2009 17:43:56 +1100 Subject: Allow continuously running games. --- pygame_snake.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'pygame_snake.py') diff --git a/pygame_snake.py b/pygame_snake.py index c2ac323..64faf9b 100755 --- a/pygame_snake.py +++ b/pygame_snake.py @@ -136,19 +136,25 @@ class PygameSnakeEngine(SnakeEngine): if running: time.sleep(2) - # Early window close, late process cleanup. - pygame.display.quit() - if __name__ == '__main__': from bots import * from oldbot import BotWrapper + ROWS = 25 + COLUMNS = 25 + APPLES = 50 + game = PygameSnakeEngine(ROWS, COLUMNS, APPLES, results=True) + while True: - game = PygameSnakeEngine(25, 25, 50, results=True) game.add_bot(right_bot) game.add_bot(random_bot) game.add_bot(random_bounds_bot) game.add_bot(random_square_bot) game.add_bot(BotWrapper('oldbots/peter.py')) game.run() + game.new_game(ROWS, COLUMNS, APPLES) + + # Early window close, late process cleanup. + pygame.display.quit() + -- cgit v1.2.3