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

Bridge hidden card rep error #276

Closed
YanSong97 opened this issue Mar 23, 2023 · 2 comments
Closed

Bridge hidden card rep error #276

YanSong97 opened this issue Mar 23, 2023 · 2 comments

Comments

@YanSong97
Copy link

Great lib!

In bridge environment, the hidden card representation seems to have the incorrect hidden_player_ids for a four-player game. Correct me if am wrong, I believe line 237 should be something like hidden_player_ids = [(current_player_id + 1) % 4, (current_player_id + 3) % 4] to get the correct hidden player id. Same applies to line 239.

Appreciate it if you can double-check it.

hidden_cards_rep = np.zeros(52, dtype=int)
if not game.is_over():
if game.round.is_bidding_over():
declarer = game.round.get_declarer()
if current_player_id % 2 == declarer.player_id % 2:
hidden_player_ids = [(current_player_id + 1) % 2, (current_player_id + 3) % 2]
else:
hidden_player_ids = [declarer.player_id, (current_player_id + 2) % 2]
for hidden_player_id in hidden_player_ids:
for card in game.round.players[hidden_player_id].hand:
hidden_cards_rep[card.card_id] = 1
else:
for player in game.round.players:
if player.player_id != current_player_id:
for card in player.hand:
hidden_cards_rep[card.card_id] = 1

@billh0420
Copy link
Contributor

Thanks for finding this error. I corrected the two lines and submitted a pull request.

@daochenzha
Copy link
Member

@billh0420 @YanSong97 Thanks for the fix!

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

3 participants