fix a error where self.safe_positions[0] can't be accest
This commit is contained in:
@@ -128,9 +128,10 @@ class BetterMasterSnake(TemplateSnake):
|
||||
self.find_safe_positions()
|
||||
if self.eat_the_snake_overwrite:
|
||||
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]})
|
||||
first_key = list(self.safe_positions.keys())[0]
|
||||
self.add_calculations({"function": "eat_the_snake_overwrite", "my_head": self.my_head, "move": move, "safe_positions": self.safe_positions, "selected_move": self.safe_positions[first_key]})
|
||||
self.add_to_history({"turn": game_data["turn"], "data": self.calculations})
|
||||
return self.safe_positions[0]
|
||||
return self.safe_positions[first_key]
|
||||
|
||||
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})
|
||||
|
||||
Reference in New Issue
Block a user