Skip to content

Commit

Permalink
Support getting an observation on a terminal state in bridge
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 516207224
Change-Id: I8d1f4169cb2b5314204bbb844c6bf0acbd6af279
  • Loading branch information
DeepMind Technologies Ltd authored and lanctot committed Mar 20, 2023
1 parent bec9201 commit 6c0b37a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions open_spiel/games/bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,13 @@ void BridgeState::WriteObservationTensor(Player player,
ptr += kNumPlayers * kNumCards;

// Current trick
int leader = tricks_[current_trick].Leader();
for (int i = 0; i < this_trick_cards_played; ++i) {
int card = history_[this_trick_start + i].action;
int relative_player = (i + leader + kNumPlayers - player) % kNumPlayers;
ptr[relative_player * kNumCards + card] = 1;
if (phase_ != Phase::kGameOver) {
int leader = tricks_[current_trick].Leader();
for (int i = 0; i < this_trick_cards_played; ++i) {
int card = history_[this_trick_start + i].action;
int relative_player = (i + leader + kNumPlayers - player) % kNumPlayers;
ptr[relative_player * kNumCards + card] = 1;
}
}
ptr += kNumPlayers * kNumCards;

Expand Down

0 comments on commit 6c0b37a

Please sign in to comment.