2018-10-23 16:27:27 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2018-12-13 10:57:22 +01:00
|
|
|
import contextlib
|
|
|
|
with contextlib.redirect_stdout(None):
|
|
|
|
import pygame
|
2018-10-23 16:27:27 +02:00
|
|
|
|
2018-12-13 11:27:41 +01:00
|
|
|
from snake.map import Map
|
|
|
|
from snake.game import Game
|
|
|
|
from snake.window import Window
|
2018-12-13 11:55:44 +01:00
|
|
|
from snake.player import Player, Direction, ConstantDecision
|
2018-10-23 16:27:27 +02:00
|
|
|
|
|
|
|
def main():
|
|
|
|
pygame.init()
|
|
|
|
|
|
|
|
width = 40
|
|
|
|
height = 40
|
|
|
|
|
|
|
|
game = Game(width, height, [
|
2018-12-13 11:55:44 +01:00
|
|
|
Player(0, 0, (255, 0, 0), ConstantDecision(Direction.LEFT)),
|
|
|
|
Player(width - 1, height - 1, (0, 255, 0), ConstantDecision(Direction.RIGHT)),
|
2018-10-23 16:27:27 +02:00
|
|
|
])
|
|
|
|
|
2018-12-13 11:27:41 +01:00
|
|
|
game.main_loop()
|
2018-10-23 16:27:27 +02:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|
|
|
|
|