This commit is contained in:
Chris Proctor 2022-05-05 16:41:42 -04:00
parent 460b60ab63
commit ffd47a8c8f
1 changed files with 2 additions and 3 deletions

View File

@ -51,9 +51,9 @@ def choose_best_action(state):
def get_value(state, depth=0, debug=False): def get_value(state, depth=0, debug=False):
"""Determines the value of the state. """Determines the value of the state.
""" """
if is_win(state, state["player"]): if is_win(state, 'X'):
return 1 return 1
elif is_win(state, get_opponent(state["player"])): elif is_win(state, 'O'):
return -1 return -1
elif is_draw(state): elif is_draw(state):
return 0 return 0
@ -61,7 +61,6 @@ def get_value(state, depth=0, debug=False):
action, result, value = choose_best_action(state) action, result, value = choose_best_action(state)
return value return value
# ================================== HELPERS ============================================== # ================================== HELPERS ==============================================
def get_opponent(player): def get_opponent(player):