Add state arguments
This commit is contained in:
parent
3bc2251b52
commit
0d6a581a01
|
@ -45,9 +45,9 @@ class TTTGame:
|
|||
we set the reward for X winning to 1 and the reward for O winning to -1.
|
||||
All other states (unfinished games and games which ended in a draw) are worth 0.
|
||||
"""
|
||||
if self.check_winner('X'):
|
||||
if self.check_winner(state, 'X'):
|
||||
return 1
|
||||
elif self.check_winner('O'):
|
||||
elif self.check_winner(state, 'O'):
|
||||
return -1
|
||||
else:
|
||||
return 0
|
||||
|
@ -73,7 +73,7 @@ class TTTGame:
|
|||
"Checks whether a move is valid"
|
||||
return move in self.get_valid_moves()
|
||||
|
||||
def board_is_full(state, self):
|
||||
def board_is_full(self, state):
|
||||
"Checks whether all the spaces in the board are occupied."
|
||||
for space in state["board"]:
|
||||
if space == '-':
|
||||
|
|
Loading…
Reference in New Issue