Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in chess terminal determination? #1160

Closed
XintianHan opened this issue Dec 16, 2023 · 2 comments
Closed

bug in chess terminal determination? #1160

XintianHan opened this issue Dec 16, 2023 · 2 comments

Comments

@XintianHan
Copy link

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!

@lanctot
Copy link
Collaborator

lanctot commented Dec 16, 2023

Hi, I think this is because a state is getting repeated 3 times: https://en.wikipedia.org/wiki/Threefold_repetition

Checked by this function:

// Draw can be claimed under the FIDE 3-fold repetition rule (the current

Use print(state.debug_string()) throughout the history to see it visually.

@XintianHan
Copy link
Author

Hi, I think this is because a state is getting repeated 3 times: https://en.wikipedia.org/wiki/Threefold_repetition

Checked by this function:

// Draw can be claimed under the FIDE 3-fold repetition rule (the current

Use print(state.debug_string()) throughout the history to see it visually.

Thanks! This actually the case!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants