move files and get ready for new Classes

This commit is contained in:
2024-04-01 03:50:12 +02:00
parent d7d069acc3
commit 0d7739df76
5 changed files with 11 additions and 5 deletions
+3
View File
@@ -0,0 +1,3 @@
from snakes.MySnake import MySnake
SNAKE = MySnake()
+3 -4
View File
@@ -10,8 +10,8 @@
# To get you started we've included code to prevent your Battlesnake from moving backwards.
# For more info see docs.battlesnake.com
from config import SNAKE
import typing
import server_logic
# info is called when you create your Battlesnake on play.battlesnake.com
# and controls your Battlesnake's appearance
@@ -36,13 +36,12 @@ def end(game_state: typing.Dict):
print("GAME OVER\n")
def move(game_state: typing.Dict) -> typing.Dict:
next_move = server_logic.choose_move(game_state)
next_move = SNAKE.choose_move(game_state)
print(f"MOVE {game_state['turn']}: {next_move}")
return {"move": next_move}
# Start server when `python main.py` is run
if __name__ == "__main__":
from server import run_server
from server.server import run_server
run_server({"info": info, "start": start, "move": move, "end": end})
View File
Executable
+4
View File
@@ -0,0 +1,4 @@
BATTLESNAKE_CLI=battlesnake_cli_1.2.3_Linux_x86_64/battlesnake
$BATTLESNAKE_CLI play -W 11 -H 11 --name 'Python Starter Project' --url http://localhost:8000 -g solo --browser
+1 -1
View File
@@ -12,7 +12,7 @@ in the folder where this file exists:
"""
import unittest
from server_logic import avoid_my_neck
from snakes.MySnake import avoid_my_neck
class AvoidNeckTest(unittest.TestCase):