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

[Internal change] Decompose the game logic and API #1127

Open
19 of 34 tasks
sotetsuk opened this issue Dec 20, 2023 · 2 comments
Open
19 of 34 tasks

[Internal change] Decompose the game logic and API #1127

sotetsuk opened this issue Dec 20, 2023 · 2 comments

Comments

@sotetsuk
Copy link
Owner

sotetsuk commented Dec 20, 2023

I believe that the API of Pgx is sufficiently general, but the optimal API varies depending on the use case. I would like to separate the implementation functions of each game's logic and the API, to make it easier for users to adjust to their preferred API.

For example,

  • core.State -> core.EnvState, GameState
  • Each game implements
    • step(game_state, action) -> game_state
    • legal_action_maks(game_state)
    • is_terminal(game_state)
    • observe(game_state)
    • terminal_value(game_state) ?

@carlosgmartin
Copy link
Contributor

carlosgmartin commented Mar 12, 2024

@sotetsuk How would this approach handle intermediate rewards?

@sotetsuk
Copy link
Owner Author

sotetsuk commented Mar 15, 2024

Sorry for the late response 🙏 It depends on the game.
In the case of Go, it looks like https://github.com/sotetsuk/pgx/blob/main/pgx/_src/games/go.py#L129

Note that this change is just a internal change and is supposed to give no effects to the current public API.

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