move files and get ready for new Classes
This commit is contained in:
@@ -10,8 +10,8 @@
|
|||||||
# To get you started we've included code to prevent your Battlesnake from moving backwards.
|
# To get you started we've included code to prevent your Battlesnake from moving backwards.
|
||||||
# For more info see docs.battlesnake.com
|
# For more info see docs.battlesnake.com
|
||||||
|
|
||||||
|
from config import SNAKE
|
||||||
import typing
|
import typing
|
||||||
import server_logic
|
|
||||||
|
|
||||||
# info is called when you create your Battlesnake on play.battlesnake.com
|
# info is called when you create your Battlesnake on play.battlesnake.com
|
||||||
# and controls your Battlesnake's appearance
|
# and controls your Battlesnake's appearance
|
||||||
@@ -36,13 +36,12 @@ def end(game_state: typing.Dict):
|
|||||||
print("GAME OVER\n")
|
print("GAME OVER\n")
|
||||||
|
|
||||||
def move(game_state: typing.Dict) -> typing.Dict:
|
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}")
|
print(f"MOVE {game_state['turn']}: {next_move}")
|
||||||
|
|
||||||
return {"move": next_move}
|
return {"move": next_move}
|
||||||
|
|
||||||
# Start server when `python main.py` is run
|
# Start server when `python main.py` is run
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
from server import run_server
|
from server.server import run_server
|
||||||
|
|
||||||
run_server({"info": info, "start": start, "move": move, "end": end})
|
run_server({"info": info, "start": start, "move": move, "end": end})
|
||||||
|
|||||||
Executable
+4
@@ -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
@@ -12,7 +12,7 @@ in the folder where this file exists:
|
|||||||
"""
|
"""
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from server_logic import avoid_my_neck
|
from snakes.MySnake import avoid_my_neck
|
||||||
|
|
||||||
|
|
||||||
class AvoidNeckTest(unittest.TestCase):
|
class AvoidNeckTest(unittest.TestCase):
|
||||||
|
|||||||
Reference in New Issue
Block a user