move created files into own data folder and add in .gitignore file

This commit is contained in:
2024-04-12 11:19:43 +02:00
parent 664c374fbf
commit 7141266b95
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -5,4 +5,4 @@
.vscode
.venv/
__pycache__/
history/
data/
+2 -2
View File
@@ -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)