den-o-battlesnakes/snakes/snake.py

34 lines
1.1 KiB
Python
Raw Normal View History

2023-09-08 03:36:08 +00:00
import typing
class Snake:
SNAKES: typing.Dict[str, typing.Type["Snake"]] = {}
2023-09-09 16:34:46 +00:00
name = "snake"
2023-09-08 03:36:08 +00:00
def __init_subclass__(cls) -> None:
2023-09-09 16:34:46 +00:00
cls.SNAKES[cls.name] = cls
2023-09-08 03:36:08 +00:00
def info(self) -> typing.Dict:
'''info is called when you create your Battlesnake on play.battlesnake.com
and controls your Battlesnake's appearance
TIP: If you open your Battlesnake URL in a browser you should see this data
'''
raise NotImplementedError()
def start(self, game_state: typing.Dict) -> None:
'''start is called when your Battlesnake begins a game'''
raise NotImplementedError()
def end(self, game_state: typing.Dict) -> None:
'''end is called when your Battlesnake finishes a game'''
raise NotImplementedError()
def move(self, game_state: typing.Dict) -> typing.Dict:
'''move is called on every turn and returns your next move
Valid moves are "up", "down", "left", or "right"
See https://docs.battlesnake.com/api/example-move for available data
'''
raise NotImplementedError()