Skip to content

Commit

Permalink
modify .gitignore file
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuliquan committed Jul 8, 2018
1 parent f36f066 commit 38f9072
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea/
__pycache__/
Binary file modified __pycache__/minimax.cpython-36.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions minimax.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ def recurse(state: State, alpha, beta) -> Tuple[int, object]:
if state.player == self.player:
max_value = (float("-inf"), None)
for action in available_actions:
max_value = max(max_value, (recurse(state.get_next_state(action), alpha, beta)[0], action))
max_value = max(max_value, (recurse(state.get_next_state(action), alpha, beta)[0], action), key=lambda x:x[0])
alpha = max(alpha, max_value[0])
if beta <= alpha:
break
return max_value
elif state.player == get_opponent(self.player):
min_value = (float("inf"), None)
for action in available_actions:
min_value = min(min_value, (recurse(state.get_next_state(action), alpha, beta)[0], action))
min_value = min(min_value, (recurse(state.get_next_state(action), alpha, beta)[0], action), key=lambda x:x[0])
beta = min(beta, min_value[0])
if beta <= alpha:
break
Expand Down

0 comments on commit 38f9072

Please sign in to comment.