Skip to content

Commit

Permalink
Added new parameters. Some minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ThorvaldAagaard committed Jun 18, 2024
1 parent a364712 commit 0bdbee2
Show file tree
Hide file tree
Showing 36 changed files with 350 additions and 179 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ UCBC 2024/Boards/Thorvald/BBA - 25.05.2024 14.08.ben
UCBC 2024/Boards/Thorvald/issues.bba
src/SuitC.pbn
src/Suic.Pbn
src/v0.8.0
src/v0.8.0*
2 changes: 1 addition & 1 deletion UCBC 2024/Conf/UCBC2024.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ search_threshold = 0.07
no_search_threshold = 0.999
# Evaluate min_passout_candidates bids if auction longer than this. Setting to -1 will disable
eval_after_bid_count = 12
# Disabling simulation for opening bid
# If False the opening bid will be without simulation, even with multiple canddates
eval_opening_bid = False
# Minimum number of candidates examined in the passout situation
min_passout_candidates = 2
Expand Down
2 changes: 1 addition & 1 deletion UCBC 2024/Conf/UCBC2024src.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ search_threshold = 0.07
no_search_threshold = 0.999
# Evaluate min_passout_candidates bids if auction longer than this. Setting to -1 will disable
eval_after_bid_count = 12
# Disabling simulation for opening bid
# If False the opening bid will be without simulation, even with multiple canddates
eval_opening_bid = False
# Minimum number of candidates examined in the passout situation
min_passout_candidates = 2
Expand Down
23 changes: 17 additions & 6 deletions UCBC 2024/MvsM/GIB.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[models]
# BEN NS
# BEN NS and EW
name = GIB 2/1
api = True
# Model version 1 drops state for bidding, and introduce different system for NS and EW
Expand Down Expand Up @@ -27,15 +27,19 @@ info = models/GIB/binfo_V2-3130000
# If there are multiple bids over this threshold make a simulation for the bids
search_threshold = 0.07
# If there is bid above this threshold, make that bid ignoring other bids
no_search_threshold = 0.999
no_search_threshold = 1
# Evaluate min_passout_candidates bids if auction longer than this. Setting to -1 will disable
eval_after_bid_count = 12
# Disabling simulation for opening bid
# If False the opening bid will be without simulation, even with multiple canddates
eval_opening_bid = False
# Add Pass as a bid to evaluate after this number of bids
eval_pass_after_bid_count = 12
# Minimum number of candidates examined in the passout situation
min_passout_candidates = 2
# Use bidding quality in evaluation (if not good just use neural network)
use_biddingquality = True
# For very long bidding sequnces we can't find decent samples, so do not make quality check
no_biddingquality_after_bid_count = 12
# Upvote the samples that matches the bidding best - used when double dumme
use_probability = True
# Before the final pass validate the contract with a neural network
Expand All @@ -47,7 +51,7 @@ min_rescue_reward = 250
# Max expected score to evaluate rescue bid
max_estimated_score = 300
# Alert implemented in bidding model
alert_supported = False
alert_supported = True

[adjustments]
# Are adjustments enabled
Expand Down Expand Up @@ -123,7 +127,12 @@ use_biddinginfo = True
# Use bidding quality in evaluation, if bad samples, just use neural network
use_biddingquality_in_eval = True
# Use SuitC to find the card for single suit combinations
use_suitc = False
use_suitc = True
# Only check trump in suit contracts (and all suits in NT)
suitc_sidesuit_check = False
# Drawing trump, reward is given if opponents has trump penalty if not
draw_trump_reward = 0.25
draw_trump_penalty = 0.25

[pimc]
# Are we using PIMC as declarer or defender?
Expand All @@ -138,7 +147,7 @@ pimc_start_trick_defender = 8
pimc_constraints = True
# On every trick create new constraints based on samples. If false only do it, when PIMC kicks in
# The API is stateless and will establish constraints at each trick
pimc_constraints_each_trick = False
pimc_constraints_each_trick = True
# Stop evaluation after finding the number of playouts unles pimc_wait expires before
pimc_max_playouts = 10000
# Max number of threads PIMC is allowed to use
Expand All @@ -147,6 +156,8 @@ pimc_max_threads = -1
pimc_autoplaysingleton = True
# PIMC trust NN
pimc_trust_NN = 0.00
# Combine with BEN double dummy
pimc_ben_dd = True

[sampling]
# Filter to remove hands, where the opening lead was not suggested by the neural network
Expand Down
2 changes: 1 addition & 1 deletion UCBC 2024/MvsM/Human.conf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ search_threshold = 0.07
no_search_threshold = 0.999
# Evaluate min_passout_candidates bids if auction longer than this. Setting to -1 will disable
eval_after_bid_count = 12
# Disabling simulation for opening bid
# If False the opening bid will be without simulation, even with multiple canddates
eval_opening_bid = False
# Minimum number of candidates examined in the passout situation
min_passout_candidates = 2
Expand Down
2 changes: 1 addition & 1 deletion UCBC 2024/MvsM/Lia.conf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ search_threshold = 0.07
no_search_threshold = 0.999
# Evaluate min_passout_candidates bids if auction longer than this. Setting to -1 will disable
eval_after_bid_count = 12
# Disabling simulation for opening bid
# If False the opening bid will be without simulation, even with multiple canddates
eval_opening_bid = False
# Minimum number of candidates examined in the passout situation
min_passout_candidates = 2
Expand Down
2 changes: 1 addition & 1 deletion UCBC 2024/MvsM/MB.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ search_threshold = 0.07
no_search_threshold = 0.999
# Evaluate min_passout_candidates bids if auction longer than this. Setting to -1 will disable
eval_after_bid_count = 12
# Disabling simulation for opening bid
# If False the opening bid will be without simulation, even with multiple canddates
eval_opening_bid = False
# Minimum number of candidates examined in the passout situation
min_passout_candidates = 2
Expand Down
2 changes: 1 addition & 1 deletion UCBC 2024/MvsM/Q-Plus.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ search_threshold = 0.07
no_search_threshold = 0.999
# Evaluate min_passout_candidates bids if auction longer than this. Setting to -1 will disable
eval_after_bid_count = 12
# Disabling simulation for opening bid
# If False the opening bid will be without simulation, even with multiple canddates
eval_opening_bid = False
# Minimum number of candidates examined in the passout situation
min_passout_candidates = 2
Expand Down
15 changes: 11 additions & 4 deletions UCBC 2024/MvsM/SAYC.conf
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[models]
# BEN NS and EW
name = SAYC
api = true
api = True
# Model version 1 drops state for bidding, and introduce different system for NS and EW
# Model version 2 includes 4 bids when making the lookup
model_version = 2
# Version of tensorflow to use
tf_version = 1
# NS is SAYC and EW is WBridge5 with SAYC
# NS and EW play the same system
NS = -1
EW = -1
# If using BBA the following NS and EW must match BBA's systems (0 =2/1, 1=SAYC, 2=WJ, 3=PC, 4=Acol)
Expand All @@ -30,7 +30,7 @@ search_threshold = 0.07
no_search_threshold = 0.999
# Evaluate min_passout_candidates bids if auction longer than this. Setting to -1 will disable
eval_after_bid_count = 12
# Disabling simulation for opening bid
# If False the opening bid will be without simulation, even with multiple canddates
eval_opening_bid = False
# Minimum number of candidates examined in the passout situation
min_passout_candidates = 2
Expand Down Expand Up @@ -123,7 +123,12 @@ use_biddinginfo = True
# Use bidding quality in evaluation, if bad samples, just use neural network
use_biddingquality_in_eval = True
# Use SuitC to find the card for single suit combinations
use_suitc = False
use_suitc = True
# Only check trump in suit contracts (and all suits in NT)
suitc_sidesuit_check = False
# Drawing trump, reward is given if opponents has trump penalty if not
draw_trump_reward = 0.25
draw_trump_penalty = 0.25

[pimc]
# Are we using PIMC as declarer or defender?
Expand All @@ -147,6 +152,8 @@ pimc_max_threads = -1
pimc_autoplaysingleton = True
# PIMC trust NN
pimc_trust_NN = 0.00
# Combine with BEN double dummy
pimc_ben_dd = False

[sampling]
# Filter to remove hands, where the opening lead was not suggested by the neural network
Expand Down
2 changes: 1 addition & 1 deletion UCBC 2024/MvsM/Shark.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ search_threshold = 0.07
no_search_threshold = 0.999
# Evaluate min_passout_candidates bids if auction longer than this. Setting to -1 will disable
eval_after_bid_count = 12
# Disabling simulation for opening bid
# If False the opening bid will be without simulation, even with multiple canddates
eval_opening_bid = False
# Minimum number of candidates examined in the passout situation
min_passout_candidates = 2
Expand Down
2 changes: 1 addition & 1 deletion UCBC 2024/MvsM/WBridge5.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ search_threshold = 0.07
no_search_threshold = 0.999
# Evaluate min_passout_candidates bids if auction longer than this. Setting to -1 will disable
eval_after_bid_count = 12
# Disabling simulation for opening bid
# If False the opening bid will be without simulation, even with multiple canddates
eval_opening_bid = False
# Minimum number of candidates examined in the passout situation
min_passout_candidates = 2
Expand Down
25 changes: 18 additions & 7 deletions UCBC 2024/MvsM/jackos.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ api = true
model_version = 2
# Version of tensorflow to use
tf_version = 1
# NS is SAYC and EW is WBridge5 with SAYC
# NS and EW play the same system
NS = -1
EW = -1
# If using BBA the following NS and EW must match BBA's systems (0 =2/1, 1=SAYC, 2=WJ, 3=PC, 4=Acol)
Expand All @@ -29,17 +29,21 @@ search_threshold = 0.001
# If there is bid above this threshold, make that bid ignoring other bids
no_search_threshold = 0.95
# Evaluate min_passout_candidates bids if auction longer than this. Setting to -1 will disable
eval_after_bid_count = 6
# Disabling simulation for opening bid
eval_after_bid_count = 3
# If False the opening bid will be without simulation, even with multiple canddates
eval_opening_bid = False
# Add Pass as a bid to evaluate after this number of bids
eval_pass_after_bid_count = 12
# Minimum number of candidates examined in the passout situation
min_passout_candidates = 2
# Use bidding quality in evaluation (if not good just use neural network)
use_biddingquality = True
# For very long bidding sequnces we can't find decent samples, so do not make quality check
no_biddingquality_after_bid_count = 12
# Upvote the samples that matches the bidding best - used when double dumme
use_probability = True
use_probability = False
# Before the final pass validate the contract with a neural network
check_final_contract = True
check_final_contract = False
# How many samples checked
max_samples_checked = 20
# Minimum gain for making a rescue bid
Expand All @@ -51,7 +55,7 @@ alert_supported = False

[adjustments]
# Are adjustments enabled
use_adjustment = False
use_adjustment = True
# Add extra weigth on scores from neural network
# The score from NN is multiplied to this and added to expected score
adjust_NN = 50
Expand Down Expand Up @@ -86,7 +90,7 @@ double_dummy = True
# Force a minimum number of leads to consider - overrides lead_threshold
min_opening_leads = 4
# Opening lead agreement (random, attitude, 135 or 24)
lead_from_pips_nt = 24
lead_from_pips_nt = attitude
lead_from_pips_suit = 135

[eval]
Expand Down Expand Up @@ -124,6 +128,11 @@ use_biddinginfo = True
use_biddingquality_in_eval = True
# Use SuitC to find the card for single suit combinations
use_suitc = False
# Only check trump in suit contracts (and all suits in NT)
suitc_sidesuit_check = False
# Drawing trump, reward is given if opponents has trump penalty if not
draw_trump_reward = 0.25
draw_trump_penalty = 0.25

[pimc]
# Are we using PIMC as declarer or defender?
Expand All @@ -147,6 +156,8 @@ pimc_max_threads = -1
pimc_autoplaysingleton = True
# PIMC trust NN
pimc_trust_NN = 0.00
# Combine with BEN double dummy
pimc_ben_dd = False

[sampling]
# Filter to remove hands, where the opening lead was not suggested by the neural network
Expand Down
Binary file modified bin/BGADLL.dll
Binary file not shown.
Binary file modified bin/BGADLL.pdb
Binary file not shown.
2 changes: 1 addition & 1 deletion demo/viz.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
let i = 0
log['bids'].forEach(data => {
document.querySelector('#info').innerHTML += `
<p class="bid"><strong>Bid:</strong> ${data.bid} ${data.who ? ' by ' + data.who : ''}</p>
<p class="bid"><strong>Bid:</strong> ${data.bid}${data.alert=="True"? "*":""} ${data.who ? ' by ' + data.who : ''}</p>
`;
if (data.candidates && data.candidates.length > 0)
document.querySelector('#info').innerHTML += `
Expand Down
2 changes: 1 addition & 1 deletion scripts/match/bidding/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ search_threshold = 0.07
no_search_threshold = 0.999
# Evaluate min_passout_candidates bids if auction longer than this. Setting to -1 will disable
eval_after_bid_count = 12
# Disabling simulation for opening bid
# If False the opening bid will be without simulation, even with multiple canddates
eval_opening_bid = False
# Minimum number of candidates examined in the passout situation
min_passout_candidates = 2
Expand Down
2 changes: 1 addition & 1 deletion scripts/match/bidding/default_noadjust.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ search_threshold = 0.07
no_search_threshold = 0.999
# Evaluate min_passout_candidates bids if auction longer than this. Setting to -1 will disable
eval_after_bid_count = 12
# Disabling simulation for opening bid
# If False the opening bid will be without simulation, even with multiple canddates
eval_opening_bid = False
# Minimum number of candidates examined in the passout situation
min_passout_candidates = 2
Expand Down
4 changes: 2 additions & 2 deletions scripts/match/bidding/default_nosearch.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ search_threshold = -1
no_search_threshold = 0.999
# Evaluate min_passout_candidates bids if auction longer than this. Setting to -1 will disable
eval_after_bid_count = 12
# Disabling simulation for opening bid
# If False the opening bid will be without simulation, even with multiple canddates
eval_opening_bid = False
# Minimum number of candidates examined in the passout situation
min_passout_candidates = 2
Expand All @@ -43,7 +43,7 @@ min_rescue_reward = 250
# Max expected score to evaluate rescue bid
max_estimated_score = 300
# Alert implemented in bidding model
alert_supported = False
alert_supported = True

[adjustments]
# Are adjustments enabled
Expand Down
2 changes: 1 addition & 1 deletion scripts/training/bidding/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ search_threshold = -1
no_search_threshold = 0.999
# Evaluate min_passout_candidates bids if auction longer than this. Setting to -1 will disable
eval_after_bid_count = 12
# Disabling simulation for opening bid
# If False the opening bid will be without simulation, even with multiple canddates
eval_opening_bid = False
# Minimum number of candidates examined in the passout situation
min_passout_candidates = 2
Expand Down
2 changes: 1 addition & 1 deletion src/bba/BBA.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ async def async_bid(self, auction, alert=None):
return self.bid(auction)

def explain(self, auction):
print("new_hand", self.position, self.hand_str, self.dealer, self.vuln)
#print("new_hand", self.position, self.hand_str, self.dealer, self.vuln)
self.player.new_hand(self.position, self.hand_str, self.dealer, self.vuln)

for k in range(len(auction)-1):
Expand Down
8 changes: 8 additions & 0 deletions src/binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ def f(hand):
def get_shape(hand):
return np.sum(hand.reshape((hand.shape[0], 4, -1)), axis=2)

def get_shape_array(hand):
if len(hand) != 52:
raise ValueError("The input array must have exactly 52 elements.")
np_array = np.array(hand)
reshaped_array = np_array.reshape(4, 13)
counts = np.sum(reshaped_array, axis=1)

return counts.tolist()

def get_hcp(hand):
x = hand.reshape((hand.shape[0], 4, -1))
Expand Down
Loading

0 comments on commit 0bdbee2

Please sign in to comment.