Skip to content

Commit

Permalink
Minor code improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
bcollazo committed Mar 6, 2021
1 parent c7ff304 commit 4168a49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions experimental/machine_learning/players/minimax.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ def decide(self, game: Game, playable_actions):
if len(playable_actions) == 1:
return playable_actions[0]

best_value = None
best_value = float("-inf")
best_action = None
for action in playable_actions:
game_copy = game.copy()
game_copy.execute(action)

value = value_fn(game_copy, self.color)
if best_value is None or value > best_value:
if value > best_value:
best_value = value
best_action = action

Expand Down

0 comments on commit 4168a49

Please sign in to comment.