Fix python_liars_poker: players param not propagated to num_players() - #1572
Open
jaisinha77777 wants to merge 1 commit into
Open
Fix python_liars_poker: players param not propagated to num_players()#1572jaisinha77777 wants to merge 1 commit into
jaisinha77777 wants to merge 1 commit into
Conversation
GameInfo was built once at module load using the default player count,
so load_game("python_liars_poker", {"players": n}).num_players() always
returned 2 regardless of n. GameInfo (num_distinct_actions, min/max
utility, max_game_length, num_players) is now built per-instance from
the actual merged params.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #1571, per @lanctot's go-ahead there.
python_liars_poker'sGameInfowas built once at module import time using the default player count (_MIN_NUM_PLAYERS), and that same object was reused for every instance regardless of theplayersparam actually passed in. So:num_distinct_actions,min_utility/max_utility, andmax_game_lengthwere all similarly stuck at their 2-player values too, since they're derived fromnum_playersin the same formulas.Fix: build
GameInfoinside__init__from the actual merged params (mirroring how other parameterized games in this file set, e.g.pig.cc, handle it), instead of a shared module-level constant.Testing:
pyspiel.load_game("python_liars_poker", {"players": n}).num_players() == nfor n in 2-6.pyspiel.random_sim_testpasses for players in 2-6, with serialization.liars_poker_test.pysuite passes unchanged (10/10).