fix error in eat_the_snake_overwrite when more moves are posible

This commit is contained in:
2024-04-16 00:52:18 +02:00
parent e3d7cccb64
commit f6db5cb96a
+7 -1
View File
@@ -125,7 +125,13 @@ class BetterMasterSnake(TemplateSnake):
self.find_safe_positions()
if self.eat_the_snake_overwrite:
self.add_calculations({"function": "eat_the_snake_overwrite", "my_head": self.my_head, "move": move})
if len(self.safe_positions) > 1:
self.add_calculations({"function": "eat_the_snake_overwrite", "my_head": self.my_head, "move": move, "safe_positions": self.safe_positions[0]})
self.add_to_history({"turn": game_data["turn"], "data": self.calculations})
return self.safe_positions[0]
self.add_calculations({"function": "eat_the_snake_overwrite", "my_head": self.my_head, "move": move, "safe_positions": self.safe_positions})
self.add_to_history({"turn": game_data["turn"], "data": self.calculations})
return self.safe_positions
if self.game_type == "constrictor":