Files
snake-python/main.py
T

37 lines
1.3 KiB
Python
Executable File

#!/usr/bin/env python3
# Welcome to
# __________ __ __ .__ __
# \______ \_____ _/ |__/ |_| | ____ ______ ____ _____ | | __ ____
# | | _/\__ \\ __\ __\ | _/ __ \ / ___// \\__ \ | |/ // __ \
# | | \ / __ \| | | | | |_\ ___/ \___ \| | \/ __ \| <\ ___/
# |________/(______/__| |__| |____/\_____>______>___|__(______/__|__\\_____>
#
# This file can be a nice home for your Battlesnake logic and helper functions.
#
# To get you started we've included code to prevent your Battlesnake from moving backwards.
# For more info see docs.battlesnake.com
from server.CreateEnvironmentFile import CreateEnvironmentFile
from server.Server import Server
import os
# Start server when `python main.py` is run
if __name__ == "__main__":
CreateEnvironmentFile.load_dotenv({"STORE_GAME_HISTORY": True, "DEBUG": True, "SNAKE": "DummSnake"})
server = Server(
data_path=os.path.dirname(__file__),
snake_type=os.environ.get("SNAKE", "DummSnake"),
)
if os.environ.get("STORE_GAME_HISTORY", None):
server.enable_store_game_state()
server.run(
host=os.environ.get("HOST", "0.0.0.0"),
port=int(os.environ.get("PORT", "8000")),
debug=bool(os.environ.get("DEBUG", False))
)