Files
board-mate/rpi/models/game.py

30 lines
861 B
Python

class Game:
_white_name : str
_black_name : str
_time_control : int
_increments : int
_timestamp : int
_moves : list[str]
_base_fen : str
def __init__(self, white_name : str, black_name : str, time_control : int, increment : int, timestamp : int):
self._white_name = white_name
self._black_name = black_name
self._time_control = time_control
self._increments = increment
self._timestamp = timestamp
self._moves = []
def add_move(self, fen : str):
if fen is None : return
self._moves.append(fen)
def to_dict(self):
return {
"white_name": self._white_name,
"black_name": self._black_name,
"time_control": self._time_control,
"increment": self._increments,
"moves": self._moves,
}