move created files into own data folder and add in .gitignore file
This commit is contained in:
+1
-1
@@ -5,4 +5,4 @@
|
||||
.vscode
|
||||
.venv/
|
||||
__pycache__/
|
||||
history/
|
||||
data/
|
||||
|
||||
@@ -19,7 +19,7 @@ import json, os
|
||||
# and controls your Battlesnake's appearance
|
||||
# TIP: If you open your Battlesnake URL in a browser you should see this data
|
||||
def info() -> typing.Dict:
|
||||
CONFIG_PATH = os.path.join(os.path.dirname(__file__), 'snake-config.json')
|
||||
CONFIG_PATH = os.path.join(os.path.dirname(__file__), 'data', 'snake-config.json')
|
||||
snake = read_file(CONFIG_PATH, json.load)
|
||||
if not snake:
|
||||
snake = {"apiversion":"1","author":"","color":"#888888","head":"default","tail":"default"}
|
||||
@@ -37,7 +37,7 @@ def start(game_state: typing.Dict):
|
||||
|
||||
# end is called when your Battlesnake finishes a game
|
||||
def end(game_state: typing.Dict):
|
||||
HISTORY_PATH = os.path.join(os.path.dirname(__file__), 'history')
|
||||
HISTORY_PATH = os.path.join(os.path.dirname(__file__), 'dataa', 'history')
|
||||
|
||||
save_file(os.path.join(HISTORY_PATH, f"{SNAKE.__class__.__name__}-{game_state['game']['id']}.json"), SNAKE.get_history(), callback=json.dump, ensure_ascii=False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user