Skip to content

Commit

Permalink
Handling Pass out boards
Browse files Browse the repository at this point in the history
  • Loading branch information
ThorvaldAagaard committed Apr 13, 2024
1 parent a5dfaa4 commit 998bcc9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/bidding/bidding.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,13 @@ def get_contract(auction):
return contract + xx + declarer

def get_strain_i(contract):
if contract is None or contract == "PASS":
return None
return 'NSHDC'.index(contract[1])

def get_decl_i(contract):
if contract is None or contract == "PASS":
return None
return 'NESW'.index(contract[-1])

def get_bid_ids(auction, player_i, n_steps):
Expand Down
10 changes: 5 additions & 5 deletions src/bots.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,9 @@ def expected_tricks_sd(self, hands_np, auctions_np):
contract = bidding.get_contract(sample_auction)
# All pass doens't really fit, and is always 0 - we ignore it for now
if contract is None:
contracts.append("pass")
strains[i] = -1
declarers[i] = -1
contracts.append("PASS")
strains[i] = None
declarers[i] = None
else:
contracts.append(contract)
strains[i] = 'NSHDC'.index(contract[1])
Expand Down Expand Up @@ -505,7 +505,7 @@ def expected_tricks_sd_no_lead(self, hands_np, auctions_np):
contract = bidding.get_contract(sample_auction)
# All pass doesn't really fit, and is always 0 - we ignore it for now
if contract is None:
contracts.append("pass")
contracts.append("PASS")
strains[i] = -1
declarers[i] = -1
else:
Expand Down Expand Up @@ -548,7 +548,7 @@ def expected_tricks_dd(self, hands_np, auctions_np):
contract = bidding.get_contract(sample_auction)
# All pass doesn't really fit, and is always 0 - we ignore it for now
if contract is None:
contracts.append("pass")
contracts.append("PASS")
strains[i] = -1
declarers[i] = -1
else:
Expand Down

0 comments on commit 998bcc9

Please sign in to comment.