Skip to content

Fix python_liars_poker: players param not propagated to num_players() - #1572

Open
jaisinha77777 wants to merge 1 commit into
google-deepmind:masterfrom
jaisinha77777:fix-liars-poker-players
Open

Fix python_liars_poker: players param not propagated to num_players()#1572
jaisinha77777 wants to merge 1 commit into
google-deepmind:masterfrom
jaisinha77777:fix-liars-poker-players

Conversation

@jaisinha77777

Copy link
Copy Markdown

Follow-up to #1571, per @lanctot's go-ahead there.

python_liars_poker's GameInfo was 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 the players param actually passed in. So:

pyspiel.load_game("python_liars_poker", {"players": 4}).num_players()  # returns 2, not 4

num_distinct_actions, min_utility/max_utility, and max_game_length were all similarly stuck at their 2-player values too, since they're derived from num_players in the same formulas.

Fix: build GameInfo inside __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() == n for n in 2-6.
  • pyspiel.random_sim_test passes for players in 2-6, with serialization.
  • Existing liars_poker_test.py suite passes unchanged (10/10).

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.
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.

1 participant