-
Notifications
You must be signed in to change notification settings - Fork 1
/
BiddingRebid.cpp
1787 lines (1601 loc) · 60.5 KB
/
BiddingRebid.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//----------------------------------------------------------------------------------------
//
// This file and all other Easy Bridge source files are copyright (C) 2002 by Steven Han.
// Use of this file is governed by the GNU General Public License.
// See the files COPYING and COPYRIGHT for details.
//
//----------------------------------------------------------------------------------------
//
// Bidrebid.cpp
//
// Rebidding routines
//
#include "stdafx.h"
#include "EasyB.h"
#include "EasyBdoc.h"
#include "bidengine.h"
#include "PlayerStatusDialog.h"
#include "ConventionSet.h"
#include "Bidparams.h"
//
//---------------------------------------------------------------
//
// MakeRebidAsOpener()
//
// Rebid after partner's response
//
int CBidEngine::MakeRebidAsOpener()
{
CPlayerStatusDialog& status = *m_pStatusDlg;
//
if (nPartnersBid == BID_PASS)
status << "2Rebidding after opening bid of " & szPVB & " and partner's pass.\n";
else
status << "2Rebidding after opening bid of " & szPVB & " and partner's response of " & szPB & ".\n";
//
//##########################################################
//
// In general, partner may have made the following responses
// to our opening bid:
// -------------------
// pass
// 1NT (negative)
// 2NT/3NT
// 4 of a suit (triple raise)
// special convention (Stayman, Blackwood, etc.)
// single raise
// double raise
// shift(1/1 or 2/1)
// jump shift
//
//
//==========================================================
//
// First check for a convention response
// possibilities:
// --------------
// Stayman (2C/3C/4C over 1NT/2NT/3NT)
// Jacoby Transfer (to the 1NT and 2NT openings)
// Blackwood
// Other
//
//
if (pCurrConvSet->ApplyConventionTests(*m_pPlayer, *m_pHand, *m_pCardLocation, m_ppGuessedHands, *this, *m_pStatusDlg))
{
return ValidateBid(m_nBid);
}
//
//==========================================================
//
// Rebidding after partner has passed
// in general, pass unless we have a very strong hand
// (i.e., 24+ pts and a solid suit)
//
if (nPartnersBid == BID_PASS)
{
//
m_fPartnersMin = 0;
m_fPartnersMax = 5;
m_fMinTPPoints = fAdjPts + m_fPartnersMin;
m_fMaxTPPoints = fAdjPts + m_fPartnersMax;
m_fMinTPCPoints = fCardPts + m_fPartnersMin;
m_fMaxTPCPoints = fCardPts + m_fPartnersMax;
//
if ((m_fMinTPPoints >= PTS_SLAM) && (m_pHand->GetNumWinners() >= 10) &
(nSuitStrength[nPrefSuit] >= SS_ABSOLUTE))
{
status << "B3A00! Partner passed, but with " & fCardPts & "/" & fPts &
" points, " & numLikelyWinners &
" playing tricks and a solid " & szPrefS &
" suit, we have enough to try for a slam.\n";
" (Blackwood).\n";
InvokeBlackwood(nPreviousSuit);
return ValidateBid(m_nBid);
}
//
if ((m_fMinTPPoints >= PTS_GAME-1) && (numLikelyWinners >= 9))
{
// rebid at the 2 or 3 level, overcalling if necessary
m_nBid = GetCheapestShiftBid(nPrefSuit,nLastBid);
if (m_nBid < BID_3NT)
{
status << "B3A10! Partner passed, but with " & fCardPts & "/" & fPts &
" points, " & numLikelyWinners &
" playing tricks and a solid " & szPrefS &
" suit, we still want to try for game, so rebid " & BTS(m_nBid) & ".\n";
return ValidateBid(m_nBid);
}
}
// else we have no choice but to pass
m_nBid = BID_PASS;
status << "B3A20! Partner passed, showing < 6 points, so with " & fCardPts & "/" & fPts &
" points in hand and " & m_fMinTPPoints & "-" & m_fMaxTPPoints &
" total partnership points, we have no choice but to pass.\n";
return ValidateBid(m_nBid);
} // end of pass response section
//
//==========================================================
//
// Rebidding after partner bid 1NT (negative)
// partner has shown 6-10 pts
// with 12-17 pts (18-23 total) pts:
// if balanced, pass with < 16 pts, or 2NT with 16-17
// or rebid suit or show new suit if unbalanced
// with 18-19 pts (24-25 total):
// bid 2NT if balanced,
// rebid own suit or show new suit
// with 19 pts (25 total), bid 2NT or jump to 3 of a suit
// with 20+ pts (26+ total), jump to 3NT or 3 of a suit
//
if (nPartnersBid == BID_1NT)
{
//
m_fPartnersMin = OPEN_PTS(6);
m_fPartnersMax = OPEN_PTS(10);
//
status << "B3J00! With a 1NT response, partner is showing " &
m_fPartnersMin & "-" & m_fPartnersMax &
" points, a lack of good support for our " & szPVSS &
" suit, and no other suit available to bid at an appropriate level.\n";
//
m_fMinTPPoints = fAdjPts + m_fPartnersMin;
m_fMaxTPPoints = fAdjPts + m_fPartnersMax;
m_fMinTPCPoints = fCardPts + m_fPartnersMin;
m_fMaxTPCPoints = fCardPts + m_fPartnersMax;
// with a balanced hand, steer towards a NT game
if (bBalanced)
{
//
status << "2B3J10! And with a balanced hand, we want to steer towards a contract in No Trumps.\n";
// pass with 18-22 TPs & a balanced hand
if (m_fMinTPCPoints <= PTS_GAME-4)
{
m_nBid = BID_PASS;
status << "B3J14! Have " & fCardPts & " HCPS with a balanced hand, and " &
m_fMinTPCPoints & "-" & m_fMaxTPCPoints &
" pts in the partnership, so we have to pass.\n";
return ValidateBid(m_nBid);
}
//
// bid 2NT with 23-25 HCPs
//
if ((m_fMinTPCPoints >= PTS_NT_GAME-3) && (m_fMinTPCPoints < PTS_GAME))
{
m_nBid = BID_2NT;
status << "B3J18! Have " & fCardPts & " HCPS with a balanced hand, and " &
m_fMinTPCPoints & "-" & m_fMaxTPCPoints &
" pts in the partnership, so raise to 2NT.\n";
return ValidateBid(m_nBid);
}
// bid 3NT with 26-30 HCPs and all suits stopped
// or 2NT without stoppers in all suits
if ((m_fMinTPCPoints >= PTS_NT_GAME) && (m_fMinTPCPoints <= PTS_GAME+4))
{
if (bAllSuitsStopped)
{
m_nBid = BID_3NT;
status << "B3J22! Have " & fCardPts & " HCPS with a balanced hand, and " &
m_fMinTPCPoints & "-" & m_fMaxTPCPoints &
" pts in the partnership, with all suits stopped, so jump to 3NT.\n";
}
else
{
m_nBid = BID_2NT;
status << "B3J23! Have " & fCardPts & " HCPS with a balanced hand, and " &
m_fMinTPCPoints & "-" & m_fMaxTPCPoints &
" pts in the partnership, but not all suits are stopped, so just bid 2NT.\n";
}
return ValidateBid(m_nBid);
}
// with 31+ total HCPs, try for slam
// can't bid Blackwood over a 1NT, so bid slam directly
if (m_fMinTPCPoints >= PTS_SLAM-2)
{
// grand slam with 37+ pts, small slam with 33+,
// or 4NT invitational with 30-31
if (m_fMinTPCPoints >= PTS_GRAND_SLAM)
{
m_nBid = BID_7NT;
status << "B3J26! Have " & fCardPts & " HCPS with a balanced hand, and " &
" approx. " & m_fMinTPCPoints & "-" & m_fMaxTPCPoints &
" HCPs in the partnership, so go directly to a grand slam at " & BTS(m_nBid) & ".\n";
}
else if (m_fMinTPCPoints >= PTS_SLAM)
{
m_nBid = BID_6NT;
status << "B3J28! Have " & fCardPts & " HCPS with a balanced hand, and " &
" approx. " & m_fMinTPCPoints & "-" & m_fMaxTPCPoints &
" HCPs in the partnership, so go directly to a small slam at " & BTS(m_nBid) & ".\n";
}
else
{
m_nBid = BID_4NT;
status << "B3J30! Have " & fCardPts & " HCPS with a balanced hand, and " &
"approx. " & m_fMinTPCPoints & "-" & m_fMaxTPCPoints &
" HCPs in the partnership, so invite a slam by bidding " & BTS(m_nBid) & ".\n";
}
return ValidateBid(m_nBid);
}
//
}
//
// here, we're making a rebid with an unbalanced hand
//
// first find a rebid suit
nSuit = GetRebidSuit(nPreviousSuit);
TestReverseRules(nSuit);
//
if (nSuit == NONE)
{
// default back to preferred suit if nothing found
nSuit = nPrefSuit;
}
//
// 18-23 TPs: rebid
//
if (m_fMinTPPoints <= PTS_GAME-3)
{
m_nBid = GetCheapestShiftBid(nSuit,BID_1NT);
if (nSuit == nPreviousSuit)
status << "B3K10! Partner doesn't like our " & szPVS &
", but we don't have another suit we can bid, so rebid the suit at " &
BTS(m_nBid) & ".\n";
else
status << "B3K12! Since partner doesn't like our " & szPVS &
", try " & BTS(m_nBid) & ".\n";
return ValidateBid(m_nBid);
}
//
// 24-25 pts: jump shift and rebid at the 3-level
//
if ((m_fMinTPPoints >= PTS_GAME-2) && (m_fMinTPPoints < PTS_GAME))
{
m_nBid = GetJumpShiftBid(nSuit,BID_1NT);
if (nSuit == nPreviousSuit)
status << "B3K20! Partner doesn't like our " & szPVS & ", but with " &
fCardPts & "/" & fPts &
" points and no other good suit, jump rebid to " & BTS(m_nBid) & ".\n";
else
status << "B3K22! Partner doesn't like our " & szPVS & "; but with " &
fCardPts & "/" & fPts & " points, jump shift to " &
BTS(m_nBid) & ".\n";
return ValidateBid(m_nBid);
}
//
// else we have 26+ TPs: bid 3 of a new suit (forcing to game)
//
// find a new suit
int newSuit = GetNextBestSuit(nPartnersSuit, nPreviousSuit);
// bid the suit if it's decent, or else rebid the pref. suit
if (nSuitStrength[newSuit] >= SS_OPENABLE)
{
nSuit = newSuit;
m_nBid = GetJumpShiftBid(nSuit,nPartnersBid);
status << "B3K30! With " & fCardPts & "/" & fPts &
" points, jump shift to " & BTS(m_nBid) & " (forcing to game).\n";
m_bGameForceActive = TRUE;
}
else
{
// jump rebid our own suit
m_nBid = GetJumpShiftBid(nSuit,nPartnersBid);
status << "B3K30a! With " & fCardPts & "/" & fPts &
" points and no other good suits, jump rebid the " & STSS(nSuit) &
" suit at " & BTS(m_nBid) & ".\n";
}
return ValidateBid(m_nBid);
} // end of 1NT response section
//
//==========================================================
//
// Rebidding after partner bid 2NT or 3NT in response to an
// opening 1-level bid, or if they bid 4NT-7NT
// in response to an opening NT bid (NOT Blackwood)
//
// partner's point count depends on our initial bid
//
//
if ((nPreviousBidLevel == 1) &&
(nPartnersBid == BID_2NT) || (nPartnersBid == BID_3NT) ||
((nPartnersBid == BID_4NT) && (nPreviousSuit == NOTRUMP)) ||
((nPartnersBid == BID_5NT) && (nPreviousSuit == NOTRUMP)) ||
((nPartnersBid == BID_6NT) && (nPreviousSuit == NOTRUMP)) ||
((nPartnersBid == BID_7NT) && (nPreviousSuit == NOTRUMP)) )
{
// check point counts
CalcNoTrumpPoints();
// with at least a semi-balanced hand, steer towards a NT game
// if (bBalanced)
if (bSemiBalanced)
{
//
if (nPreviousSuit != NOTRUMP)
status << "2B3N10! With a balanced hand, we want to steer towards a contract in No Trumps.\n";
//
// < 26 TPs -- pass
//
if ((m_fMinTPCPoints < PTS_GAME) && (!m_bGameForceActive))
{
m_nBid = BID_PASS;
status << "B3N12! But with only about " & m_fMinTPCPoints & "-" & m_fMaxTPCPoints &
" HCPS in the partnership, we don't have enough for game, so pass.\n";
return ValidateBid(m_nBid);
}
//
// with a total of 26-31 pts, bid 3NT
//
if ((m_fMinTPCPoints >= PTS_GAME) && (m_fMinTPCPoints <= PTS_SLAM-2))
{
//
if (nPartnersBid >= BID_4NT)
{
m_nBid = BID_PASS;
status << "B3N14! With a total of approx. " & m_fMinTPCPoints & "-" & m_fMaxTPCPoints &
" HCPS in the partnership, we have to" &
((m_bInvitedToSlam)? " turn down the slam invitation and " : " ") &
"pass partner's " & szPB & " bid.\n";
}
else if (nPartnersBid == BID_2NT)
{
m_nBid = BID_3NT;
status << "B3N16! With a total of approx. " & m_fMinTPCPoints & "-" & m_fMaxTPCPoints &
" HCPS in the partnership, try for game at a " & BTS(m_nBid) &
" contract.\n";
}
else if (nPartnersBid == BID_3NT)
{
m_nBid = BID_PASS;
status << "B3N18! With approx. " & m_fMinTPCPoints & "-" & m_fMaxTPCPoints &
" HCPS in the partnership, partner's game bid of 3NT seems appropriate, so pass.\n";
}
return ValidateBid(m_nBid);
}
//
// 32+ pts -- Possible slam territory
//
if (m_fMinTPCPoints >= PTS_SLAM-1)
{
// check what partner has bid
if (nPartnersBid >= BID_4NT)
{
//
// partner made an invitational or slam bid
//
if ((nPartnersBid == BID_4NT) || (nPartnersBid == BID_5NT))
{
// invitational response to 1NT
if (m_fMinTPCPoints >= PTS_GRAND_SLAM)
{
m_nBid = BID_7NT;
status << "B3N20! Partner's invitational bid of " & szPB &
" indicates a minimum of " & m_fMinTPCPoints &
"+ points in the partnership, which is enough for a grand slam, so bid " &
BTS(m_nBid) & ".\n";
}
else if (m_fMinTPCPoints >= PTS_SLAM)
{
m_nBid = BID_6NT;
status << "B3N22! Partner's invitational bid of " & szPB &
" indicates a minimum of " & m_fMinTPCPoints &
"+ points in the partnership, which is enough for a small slam, so bid " &
BTS(m_nBid) & ".\n";
}
else
{
m_nBid = BID_PASS;
status << "B3N24! Partner's invitational bid of " & szPB &
" indicates approx. " & m_fMinTPCPoints &
"+ points in the partnership, which is not quite enough for a small slam, so pass.\n";
}
}
else
{
// partner already bid slam, either 6NT or 7NT
if (nPartnersBid == BID_6NT)
{
if (m_fMinTPCPoints >= PTS_GRAND_SLAM)
{
m_nBid = BID_7NT;
status << "B3N30! Partner has bid a small slam, and with " &
m_fMinTPCPoints & "-" & m_fMaxTPCPoints &
"HCPs in the partnership, we raise to " &
BTS(m_nBid) & ".\n";
}
else
{
m_nBid = BID_PASS;
status << "B3N32! Partner has bid a small slam, and with " &
m_fMinTPCPoints & "-" & m_fMaxTPCPoints &
"HCPs in the partnership, pass.\n";
}
}
else
{
m_nBid = BID_PASS;
status << "B3N34! Partner has already bid a grand slam, so just pass.\n";
}
}
}
else
{
//
// partner has bid 3NT or less
// look for a slam
if (m_fMinTPCPoints >= PTS_GRAND_SLAM)
{
m_nBid = BID_7NT; // bid grand slam directly
status << "B3N40! With a total of approx. " & m_fMinTPCPoints & "-" & m_fMaxTPCPoints &
" HCPS in the partnership, bid a grand slam directly at " & BTS(m_nBid) & ".\n";
}
else if (m_fMinTPCPoints >= PTS_SLAM)
{
m_nBid = BID_6NT; // bid small slam directly
status << "B3N42! With a total of approx. " & m_fMinTPCPoints & "-" & m_fMaxTPCPoints &
" HCPS in the partnership, bid a small slam directly at " & BTS(m_nBid) & ".\n";
}
else
{
// 32 pts? bid 4NT invitational (NOT Blackwood)
m_nBid = BID_4NT;
status << "B3N44! With a total of approx. " & m_fMinTPCPoints & "-" & m_fMaxTPCPoints &
" HCPS in the partnership, make an invitation towards slam at " & BTS(m_nBid) & ".\n";
}
}
return ValidateBid(m_nBid);
}
}
//
//-------------------------------------------------------
//
// here, we're making a rebid with an unbalanced hand
//
// we previously made a suit bid at the 1 level
//
//
// first find a rebid suit
//
nSuit = GetRebidSuit(nPreviousSuit);
if (nSuit == NONE)
{
// default back to preferred suit if nothing found
nSuit = nPrefSuit;
}
//
// partner made a 2NT response (13-15 HCPs)
//
if (nPartnersBid == BID_2NT)
{
// with 33+ HCPs (19+ HCPs in hand), no singletons and
// all suits stopped, bid 6NT
if ((m_fMinTPCPoints >= PTS_SLAM) && (numSuitsStopped == 4) &&
(numVoids == 0) && (numSingletons == 0))
{
if (m_fMinTPCPoints >= PTS_GRAND_SLAM)
m_nBid = BID_7NT;
else
m_nBid = BID_6NT;
status << "B3N50! With a total of " &
m_fMinTPCPoints & "-" & m_fMaxTPCPoints &
" HCPs in the partnership and a reasonably balanced distribution, and all suits stopped, we can jump to slam at " &
BTS(m_nBid) & ".\n";
return ValidateBid(m_nBid);
}
// with 33+ pts and a strong 6-card suit, jump to 6
if ((m_fMinTPPoints >= PTS_SLAM) && (numPrefSuitCards >= 6) &&
(nPrefSuitStrength >= SS_STRONG))
{
m_nBid = MAKEBID(nPrefSuit, 6);
status << "B3N50a! With a total of " &
m_fMinTPPoints & "-" & m_fMaxTPPoints &
" pts in the partnership, plus a strong " &
numPrefSuitCards & "-card " & szPrefSS &
" suit, go ahead and jump to slam at " &
BTS(m_nBid) & ".\n";
return ValidateBid(m_nBid);
}
// with 26+ tot HCPs (12+ pts in hand), no singletons and
// all suits stopped, bid 3NT for game
if ((m_fMinTPCPoints >= PTS_GAME) && (numSuitsStopped == 4) &&
(numVoids == 0) && (numSingletons == 0))
{
m_nBid = BID_3NT;
status << "B3N51! With " & fCardPts &
" HCPs, reasonably balanced distribution, and all suits stopped, we can safely bid game at " &
BTS(m_nBid) & ".\n";
return ValidateBid(m_nBid);
}
// rebid a suit with 26+ TPs, or pass with less
if (m_fMinTPPoints >= PTS_GAME)
{
m_nBid = GetCheapestShiftBid(nSuit);
if (nSuit == nPreviousSuit)
status << "B3N52! Partner wants to play in No Trumps, but we don't have a balanced distribution, so rebid " & BTS(m_nBid) & ".\n";
else
status << "B3N54! Partner wants to play in No Trumps, but we don't have a balanced distribution, so try bidding " & BTS(m_nBid) & ".\n";
}
else if (m_bGameForceActive)
{
// else if game force is active, gotta respond
if (numVoids == 0)
{
m_nBid = BID_3NT;
status << "B3N56! As partner's 2NT bid was forcing to game, we have no choice but to bid " & BTS(m_nBid) & ".\n";
return ValidateBid(m_nBid);
}
else
{
nSuit = GetRebidSuit(nPreviousSuit);
m_nBid = GetCheapestShiftBid(nSuit);
status << "B3N58! Partner's 2NT bid was forcing to game -- and with " &
((numVoids == 1)? "a void suit" :
(numVoids == 2)? "2 void suits" : "3 void suits") &
", we have no choice but to rebid " & BTS(m_nBid) & ".\n";
return ValidateBid(m_nBid);
}
}
else
{
// just pass
m_nBid = BID_PASS;
status << "B3N62! Partner wants to play in No Trumps, which we don't like, but with only " &
fCardPts & "/" & fPts & " points, we can't argue and have to pass.\n";
}
return ValidateBid(m_nBid);
}
//
// here, partner bid 3NT in response to our 1 suit bid,
// showing 16-17 points and 4-3-3-3 distribution.
//
// with 32+ TPs (16+ points in hand), look for a slam
if (m_fMinTPPoints >= PTS_SLAM-1)
{
// look for a slam
if (m_fMinTPCPoints >= PTS_GRAND_SLAM)
{
m_nBid = BID_7NT; // bid grand slam directly
status << "B3N70! Partner's 3NT response indicates a total of " &
m_fMinTPPoints & "-" & m_fMaxTPPoints &
" points in the partnership, so bid a grand slam directly at " &
BTS(m_nBid) & ".\n";
}
else if (m_fMinTPCPoints >= PTS_SLAM)
{
m_nBid = BID_6NT; // bid small slam directly
status << "B3N72! Partner's 3NT response indicates a total of " &
m_fMinTPPoints & "-" & m_fMaxTPPoints &
" points in the partnership, so bid a small slam directly at " &
BTS(m_nBid) & ".\n";
}
else
{
// 32 pts: bid 4NT invitational (not Blackwood)
m_nBid = BID_4NT;
status << "B3N74! Partner's 3NT response indicates a total of " &
m_fMinTPPoints & "-" & m_fMaxTPPoints &
" points in the partnership, so make an invitation towards slam at " &
BTS(m_nBid) & ".\n";
}
return ValidateBid(m_nBid);
}
// else we don't have enough for slam, so rebid a solid suit
if ((ISMAJOR(nPreviousSuit)) &&
(nPreviousSuitStrength >= SS_STRONG) &&
(bPreviousSuitIsSolid))
{
m_nBid = GetCheapestShiftBid(nPreviousSuit);
status << "B3N80! Partner wants to play at 3NT, but with a solid major in " &
szPVS & ", we prefer to play in the suit, so bid " & BTS(m_nBid) & ".\n";
return ValidateBid(m_nBid);
}
// no solid suit? then pass
if (!m_bGameForceActive)
{
m_nBid = BID_PASS;
status << "B3N85! Partner wants to play at 3NT, which we can't argue with since we lack a solid suit of our own.\n";
return ValidateBid(m_nBid);
}
else
{
nSuit = GetRebidSuit(nPreviousSuit);
m_nBid = GetCheapestShiftBid(nSuit);
status << "B3N90! In response to partner's game forcing bid, we have no choice but to express dislike for NT by bidding "& BTS(m_nBid) & ".\n";
return ValidateBid(m_nBid);
}
} // end of 2NT-7NT response section
//
//==========================================================
//
// Rebidding after partner has made a triple raise
// partner has shown < 9 HCPs
// pass with < 20 pts
//
if ((nPartnersSuit == nPreviousSuit) &&
(nPreviousBidLevel == 1) && (nPartnersBidLevel == 4))
{
//
return (RespondToTripleRaise());
} // end of triple raise response sectio
//
//==========================================================
//
// Rebidding after partner has made a single raise
// partner has shown 6-10 pts
// with 12-15 pts, pass
// with 16-18 pts:
// with < 7 playing tricks, bid a new (support) suit
// with 7+ playing tricks, jump to game
// with 19+ pts, jump to game or bid a new suit
//
if ((nPartnersSuit == nPreviousSuit) && (nPartnersBidLevel == 2))
{
//
return (RespondToSingleRaise(nPartnersBid));
} // end of single raise response section
//
//==========================================================
//
// Rebidding after partner has made a double raise
// partner has shown 13-16 pts (normal) or 11-12 pts (limit)
//
if ((nPartnersSuit == nPreviousSuit) && (nPartnersBidLevel == 3))
{
//
return (RespondToDoubleRaise(nPartnersBid));
} // end of double raise section
//
//==========================================================
//
// Rebidding after opener raised our suit 4 or more levels --
// unlikely, but possible
// e.g., 1C -> 5C, or
// 1H -> 6H
//
if ((nPartnersSuit == nPreviousSuit) &&
((nPartnersBidLevel - nPreviousBidLevel) >= 4) )
{
// partner really likes our suit
m_nAgreedSuit = nPreviousSuit;
//
//---------------------------------------------------------
// either raise to slam or pass
//
if ((nPartnersBidLevel <= 5) &&
(m_fMinTPPoints >= PTS_SLAM) && (numSupportCards >= 3))
{
m_nBid = MAKEBID(nPartnersSuit, 6);
status << "B3X1! With a total of " &
m_fMinTPPoints & "-" & m_fMaxTPPoints &
" points in the partnership, go ahead and raise partner to a small slam at " &
BTS(m_nBid) & ".\n";
return ValidateBid(m_nBid);
}
if ((nPartnersBidLevel <= 6) &&
(m_fMinTPPoints >= PTS_GRAND_SLAM) && (numSupportCards >= 3))
{
m_nBid = MAKEBID(nPartnersSuit, 7);
status << "B3X2! With a total of " &
m_fMinTPPoints & "-" & m_fMaxTPPoints &
" points in the partnership, go ahead and raise partner to a grand slam at " &
BTS(m_nBid) & ".\n";
return ValidateBid(m_nBid);
}
else
{
m_nBid = BID_PASS;
status << "B3X3! With a total of " &
m_fMinTPPoints & "-" & m_fMaxTPPoints &
" points in the partnership, we have to defer to partner's unusual jump rebid and pass.\n";
return ValidateBid(m_nBid);
}
}
//
//==========================================================
//
// Rebidding after partner has makes a 1 over 1 response
// (not 1NT), showing 6-18 points
// with 12-16 points, make a minimum rebid
// with 17-19 points, make an invitational bid
// with 20+ points, make a game forcing bd
//
//
if ((nPartnersSuit != nPreviousSuit) && (nPartnersBidLevel == 1))
{
//
m_fPartnersMin = OPEN_PTS(6);
m_fPartnersMax = OPEN_PTS(18);
// adjust max downwards if partner previously passed
if (nPartnersPrevBid == BID_PASS)
{
m_fPartnersMax = OPEN_PTS(12);
status << "2B3U00a! Partner has made a 1 over 1 bid after an earlier pass, " & szPS & " over " & szPVS &
", which shows " & m_fPartnersMin & "-" & m_fPartnersMax &
" points and is forcing for one round.\n";
}
else
{
status << "2B3U00! Partner has made a 1 over 1 bid, " & szPS & " over " & szPVS &
", which shows " & m_fPartnersMin & "-" & m_fPartnersMax &
" points and is forcing for one round.\n";
}
// get adjusted point count as dummy
fAdjPts = m_pHand->RevalueHand(REVALUE_DUMMY, nPartnersSuit, TRUE);
m_fMinTPPoints = fAdjPts + m_fPartnersMin;
m_fMaxTPPoints = fAdjPts + m_fPartnersMax;
m_fMinTPCPoints = fCardPts + m_fPartnersMin;
m_fMaxTPCPoints = fCardPts + m_fPartnersMax;
//
// with 23 or fewer TPs, bid 1NT, raise partner's suit,
// rebid suit, or bid new suit
//
if (m_fMinTPPoints <= PTS_GAME-3)
{
// single raise parnter's major with support
if ((ISMAJOR(nPartnersSuit)) &&
(nPartnersSuitSupport >= SS_WEAK_SUPPORT))
{
m_nAgreedSuit = nPartnersSuit;
m_nBid = MAKEBID(nPartnersSuit,2);
status << "B3U14! With decent " & numSupportCards &
"-card support for partner's major " & szPSS &
" suit (holding " & szHP &
"), no rebiddable suit, and no openable second suit, raise to " &
BTS(m_nBid) & ".\n";
return ValidateBid(m_nBid);
}
// bid another suit, if it's openable
// (and if we don't violate reversing rules)
nSuit = GetNextBestSuit(nPreviousSuit,nPartnersSuit);
TestReverseRules(nSuit);
if (IsSuitOpenable(nSuit))
{
m_nBid = GetCheapestShiftBid(nSuit);
if (nSuit != nPreviousSuit)
status << "B3U18! With " & SLTS(nPartnersSuit) &
" support for partner's " & szPSS &
" suit (holding " & szHP & "), and a second openable suit in " &
STS(nSuit) & " (holding " & SHTS(nSuit) & "), show it in a " &
BTS(m_nBid) & " bid.\n";
else
status << "B3U18a! With " & SLTS(nPartnersSuit) &
" support for partner's " & szPSS &" suit (holding " & szHP &
"), and no other suit available to bid, rebid the " & szPVSS &
" suit at " & BTS(m_nBid) & ".\n";
return ValidateBid(m_nBid);
}
// rebid our own suit if it's solid
if (bPreviousSuitIsRebiddable)
{
m_nBid = MAKEBID(nPreviousSuit,2);
if (ISMAJOR(nPartnersSuit))
{
status << "B3U22! With a rebiddable " & szPVSS &
" suit and insufficient support for partner's " & szPS &
" (holding " & szHP & "), rebid at " & BTS(m_nBid) & ".\n";
}
else
{
if (ISMAJOR(nPreviousSuit))
status << "B3U24! With a rebiddable major " & szPVSS &
" suit, show it in preference to raising partner's minor by rebidding " &
BTS(m_nBid) & ".\n";
else
status << "B3U26! With a rebiddable " & szPVSS &
" suit, show it in preference to raising partner's suit by rebidding " &
BTS(m_nBid) & ".\n";
}
return ValidateBid(m_nBid);
}
// else bid 1NT if hand is balanced
if (bBalanced)
{
m_nBid = BID_1NT;
if (ISMINOR(nPartnersSuit))
status << "B3U30! With a balanced distribution, bid " & BTS(m_nBid) &
" in preference to partner's minor.\n";
else
status << "B3U34! With a balanced distribution and weak support for partner's " & szPSS &
" suit (holding " & szHP & "), bid " & BTS(m_nBid) & ".\n";
return ValidateBid(m_nBid);
}
// else raise partner's minor with weak or good support
if ((ISMINOR(nPartnersSuit)) &&
(nPartnersSuitSupport >= SS_WEAK_SUPPORT))
{
m_nAgreedSuit = nPartnersSuit;
m_nBid = MAKEBID(nPartnersSuit,2);
status << "B3U40! With " & numSupportCards &
"-card support for partner's minor " & szPS &
" suit (holding " & szHP &
"), no rebiddable suit or openable second suit, and unbalanced distribution, raise to " &
BTS(m_nBid) & ".\n";
return ValidateBid(m_nBid);
}
// else no choice but to bid a negative 1NT
m_nBid = BID_1NT;
status << "B3U44! With weak support for partner's " & szPS &
" (holding " & szHP & "), and no other available bid, bid " &
BTS(m_nBid) & ".\n";
return ValidateBid(m_nBid);
}
//
// with 23-25 TPs, bid 2NT, jump bid in own or
// partner's suit, or shift to a new suit
//
if ((m_fMinTPPoints >= PTS_GAME-3) && (m_fMinTPPoints <= PTS_GAME-1))
{
// jump raise partner's major suit with 4 trumps
if ((ISMAJOR(nPartnersSuit)) &&
(numSupportCards >= 4))
{
m_nAgreedSuit = nPartnersSuit;
m_nBid = MAKEBID(nPartnersSuit,3);
status << "B3U50! With " & numSupportCards &
"-card support for partner's " & szPS &
" (holding " & szHP & ") and " &
fCardPts & "/" & fPts & "/" & fAdjPts &
" points, jump raise to " & BTS(m_nBid) & ".\n";
return ValidateBid(m_nBid);
}
// bid another good suit
nSuit = GetNextBestSuit(nPreviousSuit,nPartnersSuit);
TestReverseRules(nSuit);
if (IsSuitOpenable(nSuit))
{
m_nBid = GetCheapestShiftBid(nSuit);
status << "B3U54! With weak support for partner's " & szPSS &
" suit (holding " & szHP & "), " &
fCardPts & "/" & fPts & "/" & fAdjPts &
" points, and a second openable suit in " & STS(nSuit) &
" (holding " & SHTS(nSuit) & "), show it in a " &
BTS(m_nBid) & " bid.\n";
return ValidateBid(m_nBid);
}
// jump rebid our own suit if it's a solid six-carder
if ((nPreviousSuitStrength >= SS_STRONG) &&
(bPreviousSuitIsSolid) &&
(numPreviousSuitCards >= 6))
{
m_nBid = GetJumpShiftBid(nPreviousSuit,nPartnersBid);
status << "B3U58! With a solid " & numPreviousSuitCards &
"-card suit of our own in " & szPVS &
", and only " & SLTS(nPartnersSuit) &
" support for partner's " & szPS &
" (holding " & szHP & "), jump rebid our suit at " &
BTS(m_nBid) & ".\n";
return ValidateBid(m_nBid);
}
// else bid 2NT if hand is balanced
if ((bBalanced) && (m_fMinTPCPoints >= PTS_GAME-2))
{
// (AllOtherSuitsStopped(nPartnersSuit))) {
m_nBid = BID_2NT;
status << "B3U62! With weak support for partner's " & szPS &
" (holding " & szHP &
") and a balanced hand with " & fCardPts &
" HCPs, for a total of " & m_fMinTPCPoints & "-" & m_fMaxTPCPoints &
" HCPs in the partnership, bid " & BTS(m_nBid) & ".\n";
return ValidateBid(m_nBid);
}