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

Fixed bug in Ultimate Tic Tac Toe termination conditions #1307

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

armatthews
Copy link

Fixed bug in Ultimate Tic Tac Toe implementation that caused games to end when any small board was terminal instead of when all small boards are terminal

… end when any small board was terminal instead of when *all* small boards are terminal
@lanctot
Copy link
Collaborator

lanctot commented Feb 12, 2025

Thanks!

@lanctot
Copy link
Collaborator

lanctot commented Feb 12, 2025

Regarding the failing tests: seems like a new issue in Dark Hex is causing a compilation problem that wasn't happening before.

I am on vacation at the moment but will take a look when I get back next week. Once we fix it you can just pull the changes from master and retrigger the tests.

@lanctot
Copy link
Collaborator

lanctot commented Feb 18, 2025

Regarding the failing tests: seems like a new issue in Dark Hex is causing a compilation problem that wasn't happening before.

I am on vacation at the moment but will take a look when I get back next week. Once we fix it you can just pull the changes from master and retrigger the tests.

Ok, this fix has been merged into master. Can you pull changes from master and push the merge commit to trigger the tests again?

@lanctot
Copy link
Collaborator

lanctot commented Mar 15, 2025

@armatthews just checking to see if you can do this? Would love to give you proper credit for this fix, but I can't import it until the tests are passing.

@PatrickChrestin
Copy link

@lanctot
I have an explanation for this error: "Spiel Fatal Error: /Users/runner/work/open_spiel/open_spiel/open_spiel/tests/basic_tests.cc:494 game_length <= game.MaxGameLength()
game_length = 85, game.MaxGameLength() = 81"

It is happening because in the basic_tests.cc the game_length is increased by one when an action is performed.
An action in the game ultimate_tic_tac_toe can be either to make a move in a subboard, when only one specific sub board is available, or selecting a sub board, in which the next move will be made, if the user has the choice.
Meaning, that if the use is given the choice of the board, the game_length is increased twice per actual move in the test.

I was able to analyze the error, however I am not fit in c++, so I do not feel comfortable to attempt any fix for this.

@lanctot
Copy link
Collaborator

lanctot commented Mar 31, 2025

Good find!

Can you just change this line:

return tic_tac_toe::kNumCells * kNumSubgames;

to add a * 2 at the end (before the semicolon)?

@lanctot
Copy link
Collaborator

lanctot commented Mar 31, 2025

Oh @PatrickChrestin I just noticed you are not the original contributor of this fix.

@armatthews just quickly checking if you can finish this -- otherwise, I can make the change on our side and submit independently.

@PatrickChrestin
Copy link

yeah, sorry, I was interested in the fix for the problem.
Changing the possible game length is a fix for the problem, but doesn't it compromise the intention of the attribute?
Instead, wouldn't it be better to either:

  1. not increment the counter of game length in the test, when selecting a sub board to play in, or
  2. combine the selection of the sub board and the actual field to be performed in a single action?

the MR #1314 adapts the max game length of uttt to the max game length of a sub board times the number of sub boards.
In my opinion, selecting a sub board (without performing a move) should not be counted when considering the game length.

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

Successfully merging this pull request may close these issues.

3 participants