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

Fix #1254: Convert pyspiel game state to dict #1279

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

Conversation

Ayah-Saleh
Copy link

@Ayah-Saleh Ayah-Saleh commented Sep 26, 2024

This pull request introduces the following changes based off issue #1254:

Added ToDict() and FromDict() methods to the State class in spiel.:

  • These methods allow converting the game state to a dictionary of array-like structures and restoring the state from such a dictionary.
  • ToDict() converts the current state to a dictionary, and FromDict() restores the state from the dictionary representation.

Added a new test case in spiel_test.cc:

  • The test verifies that the ToDict() and FromDict() methods work correctly by:
  • Converting the state of a Tic-Tac-Toe game to a dictionary.
  • Creating a new game state and restoring it using the FromDict() method.
  • Making sure that the original and restored states are the same.

Copy link

google-cla bot commented Sep 26, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@lanctot
Copy link
Collaborator

lanctot commented Sep 27, 2024

Thanks @Ayah-Saleh !

Based on the test and description, I suspect that you forgot to include changes to to tic_tac_toe.h and tic_tac_toe.cc. Can you add them to the PR?

@lanctot
Copy link
Collaborator

lanctot commented Sep 27, 2024

Also can you take a quick look at this: #1254 (comment). Curious to get your thoughts.

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.

2 participants