add better typeing of knowing what GameBoard it is in GameStorage
This commit is contained in:
@@ -26,6 +26,12 @@ class GameStorage:
|
|||||||
else:
|
else:
|
||||||
self.winner_snake_names = [ x["name"] for x in snakes]
|
self.winner_snake_names = [ x["name"] for x in snakes]
|
||||||
|
|
||||||
|
def _get_type_of_gameboard(self):
|
||||||
|
if len(self.game_board[0]["snakes"]) == 2:
|
||||||
|
return "duel"
|
||||||
|
|
||||||
|
return "standart"
|
||||||
|
|
||||||
def save(self, path:str, callback=None, **kwargs):
|
def save(self, path:str, callback=None, **kwargs):
|
||||||
save_file(os.path.join(self.folder, path), {
|
save_file(os.path.join(self.folder, path), {
|
||||||
"snake": {
|
"snake": {
|
||||||
@@ -33,7 +39,8 @@ class GameStorage:
|
|||||||
"choices": self.snake_history,
|
"choices": self.snake_history,
|
||||||
},
|
},
|
||||||
"game": {
|
"game": {
|
||||||
"type": self.game_type,
|
"type": self._get_type_of_gameboard(),
|
||||||
|
"infos": self.game_type,
|
||||||
"snake_start": self.start_position,
|
"snake_start": self.start_position,
|
||||||
"gameboard": self.game_board,
|
"gameboard": self.game_board,
|
||||||
"my_moves": self.moves,
|
"my_moves": self.moves,
|
||||||
|
|||||||
Reference in New Issue
Block a user