Bugfix
This commit is contained in:
parent
460b60ab63
commit
ffd47a8c8f
|
@ -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):
|
||||||
|
|
Loading…
Reference in New Issue