add history to existing snakes

This commit is contained in:
2024-04-01 05:16:45 +02:00
parent dde746900c
commit b1c0c14444
2 changed files with 9 additions and 2 deletions
+4 -1
View File
@@ -1,7 +1,9 @@
from snakes.TemplateSnake import TemplateSnake
import random
from scipy import spatial
class LogicSnake:
class LogicSnake(TemplateSnake):
def avoid_my_body(self, my_body, possible_moves: dict) -> list:
"""
my_body: List of dictionaries of x/y coordinates for every segment of a Battlesnake.
@@ -138,6 +140,7 @@ class LogicSnake:
move = "up"
print("GOING TO LOSE!!")
self.add_to_history({"my_head": my_head, "my_body": tuple(my_body), "target": target, "possible_moves": possible_moves, "move": move})
print(f"{data['game']['id']} MOVE {data['turn']}: {move} picked from all valid options in {possible_moves}")
return move