Skip to content

Commit

Permalink
Better error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ThorvaldAagaard committed Apr 28, 2024
1 parent 558adf5 commit 5391342
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 50 deletions.
2 changes: 1 addition & 1 deletion UCBC 2024/MvsM/WBridge5.conf
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pimc_max_threads = -1
# If singleton, just play it without evaluating it
pimc_autoplaysingleton = True
# PIMC trust NN
pimc_trust_NN = 0.01
pimc_trust_NN = 0.0

[sampling]
# Filter to remove hands, where the opening lead was not suggested by the neural network
Expand Down
44 changes: 0 additions & 44 deletions install/dist/table_manager_client.spec

This file was deleted.

Binary file added src/Splash.webp
Binary file not shown.
1 change: 1 addition & 0 deletions src/bba/BBA.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def __init__(self, ns_system, ew_system, position, hand, vuln, dealer):
print("Make sure the dll is not blocked by OS (Select properties and click unblock)")
print("Make sure the dll is not writeprotected")
print('Error:', ex)
raise ex
self.ns_system = ns_system
self.ew_system = ew_system
self.vuln = vuln
Expand Down
6 changes: 4 additions & 2 deletions src/bots.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,12 +991,14 @@ async def play_card(self, trick_i, leader_i, current_trick52, players_states, bi
if self.pimc_declaring and (self.player_i == 1 or self.player_i == 3):
card52_dd = await self.pimc.nextplay(self.player_i, shown_out_suits)
if self.verbose:
assert card52_dd is not None, "PIMC result is None"
print("PIMC result:",card52_dd)
card_resp = self.pick_card_after_pimc_eval(trick_i, leader_i, current_trick, players_states, card52_dd, bidding_scores, quality, samples, play_status)
else:
if self.pimc_defending and (self.player_i == 0 or self.player_i == 2):
card52_dd = await self.pimc.nextplay(self.player_i, shown_out_suits)
if self.verbose:
assert card52_dd is not None, "PIMCDef result is None"
print("PIMC result:",card52_dd)
card_resp = self.pick_card_after_pimc_eval(trick_i, leader_i, current_trick, players_states, card52_dd, bidding_scores, quality, samples, play_status)
else:
Expand Down Expand Up @@ -1299,7 +1301,7 @@ def pick_card_after_dd_eval(self, trick_i, leader_i, current_trick, players_stat
# If we have bad quality of samples we should probably just use the neural network
if valid_bidding_samples >= 0:
if self.models.matchpoint:
candidate_cards = sorted(enumerate(candidate_cards), key=lambda x: (x[1].expected_score_dd, round(x[1].insta_score, 2), -x[0]), reverse=True)
candidate_cards = sorted(enumerate(candidate_cards), key=lambda x: (x[1].expected_score_dd, round(5*x[1].p_make_contract, 1), round(x[1].insta_score, 2), -x[0]), reverse=True)
who = "NN-MP"
else:
candidate_cards = sorted(enumerate(candidate_cards), key=lambda x: (round(5*x[1].p_make_contract, 1), int(x[1].expected_tricks_dd * 10) / 10, round(x[1].expected_score_dd, 1), round(x[1].insta_score, 2), -x[0]), reverse=True)
Expand All @@ -1316,7 +1318,7 @@ def pick_card_after_dd_eval(self, trick_i, leader_i, current_trick, players_stat
who = "DD"
else:
if self.models.matchpoint:
candidate_cards = sorted(enumerate(candidate_cards), key=lambda x: (round(x[1].expected_score_dd, 1), round(x[1].insta_score, 2), -x[0]), reverse=True)
candidate_cards = sorted(enumerate(candidate_cards), key=lambda x: (round(x[1].expected_score_dd, 1), round(5*x[1].p_make_contract, 1), round(x[1].insta_score, 2), -x[0]), reverse=True)
who = "MP-Make"
else:
candidate_cards = sorted(enumerate(candidate_cards), key=lambda x: (round(5*x[1].p_make_contract, 1), round(x[1].insta_score, 2), int(x[1].expected_tricks_dd * 10) / 10, -x[0]), reverse=True)
Expand Down
1 change: 1 addition & 0 deletions src/frontend/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ <h1>Enter Board information</h1>
function processLinFile() {
bidSequence = [];
bidSeqPoint = 0;
openinglead = ''
document.getElementById('biddingInput').value = ''
document.getElementById('playInput').value = ''
// Handle firefox lin-link
Expand Down
2 changes: 1 addition & 1 deletion src/pimc/PIMC.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,5 +396,5 @@ async def nextplay(self, player_i, shown_out_suits):
self.pimc.EndEvaluate()
if self.verbose:
print(candidate_cards)
print("Returning from PIMC")
print(f"Returning {len(candidate_cards)} from PIMC nextplay")
return candidate_cards
2 changes: 1 addition & 1 deletion src/pimc/PIMCDef.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,5 +406,5 @@ async def nextplay(self, player_i, shown_out_suits):
self.pimc.EndEvaluate()
if self.verbose:
print(candidate_cards)
print("Returning from PIMC")
print(f"Returning {len(candidate_cards)} from PIMCDef nextplay")
return candidate_cards
3 changes: 2 additions & 1 deletion src/table_manager_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,8 @@ async def receive_card_play_for(self, player_i, trick_i):
card_resp = await self.receive_line()

card_resp_parts = card_resp.strip().split()
print("card_resp_parts", card_resp_parts)
if self.verbose:
print("card_resp_parts", card_resp_parts)
assert card_resp_parts[0] == SEATS[player_i], f"{card_resp_parts[0]} != {SEATS[player_i]}"

cr = CardResp(
Expand Down

0 comments on commit 5391342

Please sign in to comment.