bug in chess terminal determination?
XintianHan opened this issue · comments
I just tried the following code
env = pyspiel.load_game("chess")
state = env.new_initial_state()
while not state.is_terminal():
actions = state.legal_actions(state.current_player())
spiel_actions = np.array(sorted(actions))
state.apply_action(spiel_actions[0])
print(str(state))
It seems that the game ended earlier before the terminal. I checked the print of the state at the last line. It's 1nbqkbnr/rppppppp/p7/8/8/P7/RPPPPPPP/1NBQKBNR w Kk - 10 7
It does not seem to be the end of the game. What's wrong here? Thanks in advance!
Hi, I think this is because a state is getting repeated 3 times: https://en.wikipedia.org/wiki/Threefold_repetition
Checked by this function:
open_spiel/open_spiel/games/chess/chess.h
Line 178 in 7c58b6c
Use print(state.debug_string())
throughout the history to see it visually.
Hi, I think this is because a state is getting repeated 3 times: https://en.wikipedia.org/wiki/Threefold_repetition
Checked by this function:
open_spiel/open_spiel/games/chess/chess.h
Line 178 in 7c58b6c
Use
print(state.debug_string())
throughout the history to see it visually.
Thanks! This actually the case!