pytron/headless.py

21 lines
468 B
Python
Raw Normal View History

2018-10-23 16:27:27 +02:00
#!/usr/bin/env python3
2018-12-13 11:27:41 +01:00
from snake.map import Map
2019-03-13 18:00:46 +01:00
from snake.game import Game, PositionPlayer
from snake.player import Player, Direction, ConstantPlayer, KeyboardPlayer
2018-10-23 16:27:27 +02:00
def main():
width = 40
height = 40
game = Game(width, height, [
2019-03-13 18:00:46 +01:00
PositionPlayer(1, KeyboardPlayer(Direction.RIGHT), [0, 0]),
PositionPlayer(2, ConstantPlayer(Direction.LEFT), [width - 1, height - 1]),
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()