make new LocalStorage Class and move save functions into it
This commit is contained in:
+3
-1
@@ -2,6 +2,8 @@ from server.Files import read_file
|
||||
from server.GameBoard import GameBoard
|
||||
from server.SnakeBuilder import SnakeBuilder
|
||||
|
||||
from statestorage.LocalStorage import LocalStorage
|
||||
|
||||
from flask import Flask
|
||||
from flask import request
|
||||
import logging, json, os, re
|
||||
@@ -133,8 +135,8 @@ class Server:
|
||||
game_board = self._get_game_board(game_state, end=True)
|
||||
if not game_board.get_winner() == "me" and not game_board.get_turn() <= self.store_game_when_win_and_moves_are_bigger_as:
|
||||
game_board.save(
|
||||
LocalStorage,
|
||||
file_path=os.path.join(self.data_path, 'data'),
|
||||
callback=json.dump, indent=2, ensure_ascii=False
|
||||
)
|
||||
|
||||
print("GAME ENDED: Winner is", [ x["name"] for x in game_state["board"]['snakes']])
|
||||
|
||||
Reference in New Issue
Block a user