bidding/follow1.pl
|
| old | | new | |
| 247 |
% follow_invite_impl(+SelfInfo, +Denomination, ?Bid) |
247 |
% follow_invite_impl(+SelfInfo, +Denomination, ?Bid) |
| 248 |
% Implementation of follow_invite state. |
248 |
% Implementation of follow_invite state. |
| 249 |
|
249 |
|
| 250 |
% pass - fewer than 8 points |
250 |
% pass - fewer than 8 points (7 for no-trump) |
| 251 |
follow_invite_impl(SelfInfo, Suit, bid(pass)) :- |
251 |
follow_invite_impl(SelfInfo, Suit, bid(pass)) :- |
| 252 |
points(SelfInfo, Suit, Points), |
252 |
points(SelfInfo, Suit, Points), |
| 253 |
Points #< 8. |
253 |
Points #< 8. |
| 254 |
follow_invite_impl(SelfInfo, no_trump, bid(pass)) :- |
254 |
follow_invite_impl(SelfInfo, no_trump, bid(pass)) :- |
| 255 |
points(SelfInfo, Points), |
255 |
points(SelfInfo, Points), |
| 256 |
Points #< 8. |
256 |
Points #< 7. |
| 257 |
|
257 |
|
| 258 |
% game - 8+ points |
258 |
% game - 8+ points (7+ for no-trump) |
| 259 |
follow_invite_impl(SelfInfo, Suit, bid(Level, Suit)) :- |
259 |
follow_invite_impl(SelfInfo, Suit, bid(Level, Suit)) :- |
| 260 |
game(Level, Suit), |
260 |
game(Level, Suit), |
| 261 |
points(SelfInfo, Suit, Points), |
261 |
points(SelfInfo, Suit, Points), |
| 262 |
Points #>= 8. |
262 |
Points #>= 8. |
| 263 |
follow_invite_impl(SelfInfo, no_trump, bid(3, no_trump)) :- |
263 |
follow_invite_impl(SelfInfo, no_trump, bid(3, no_trump)) :- |
| 264 |
points(SelfInfo, Points), |
264 |
points(SelfInfo, Points), |
| 265 |
Points #>= 8. |
265 |
Points #>= 7. |
| 266 |
|
266 |
|
| 267 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
267 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 268 |
% |
268 |
% |
| |
| |
bidding/follow1.plt
|
| old | | new | |
| 216 |
try_alone([jack, 8, 5], [jack, 9, 3], [queen, 10, 8, 7, 2], [queen, 4], |
216 |
try_alone([jack, 8, 5], [jack, 9, 3], [queen, 10, 8, 7, 2], [queen, 4], |
| 217 |
[bid(3, clubs), bid(1, diamonds), bid(1, clubs)], Bid). |
217 |
[bid(3, clubs), bid(1, diamonds), bid(1, clubs)], Bid). |
| 218 |
|
218 |
|
|
|
219 |
% raise 2NT to 3NT with even just 7 points |
|
|
220 |
|
|
|
221 |
test(invitational_w4, [true(Bid =@= bid(3, no_trump)), nondet]) :- |
|
|
222 |
try_alone([ace, 8, 4, 2], [queen, 8], [jack, 10, 5, 3], [9, 8, 2], |
|
|
223 |
[bid(2, no_trump), bid(1, spades), bid(1, hearts)], Bid). |
|
|
224 |
|
| 219 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
225 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 220 |
% |
226 |
% |
| 221 |
% After opener bids a new suit at the 1-level. |
227 |
% After opener bids a new suit at the 1-level. |
| |
| old | | new | |
| 453 |
try_alone([jack, 8], [king, 2], [ace, jack, 4, 3], [king, queen, 9, 5, 3], |
459 |
try_alone([jack, 8], [king, 2], [ace, jack, 4, 3], [king, queen, 9, 5, 3], |
| 454 |
[bid(2, hearts), bid(2, clubs), bid(1, diamonds)], Bid). |
460 |
[bid(2, hearts), bid(2, clubs), bid(1, diamonds)], Bid). |
| 455 |
|
461 |
|
|
|
462 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
|
463 |
% |
|
|
464 |
% Final test. |
|
|
465 |
% |
|
|
466 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
|
467 |
|
|
|
468 |
% For South's hand, the book has: |
|
|
469 |
% hand([king, 2], [ace, king, queen], [king, queen, jack, 10], [jack, 10, 9, 8]) |
|
|
470 |
% which treats jacks as stoppers, which looks dubious and seems to contradict |
|
|
471 |
% other examples. I've swapped the jack with the queen in hearts to make things |
|
|
472 |
% a bit more sane. |
|
|
473 |
|
|
|
474 |
test(full_deal, [nondet]) :- |
|
|
475 |
try_all_bids( |
|
|
476 |
hand([queen, jack, 6, 4, 3], [5, 2], [9, 3, 2], [king, 7, 3]), % west |
|
|
477 |
hand([ace, 7], [jack, 9, 8, 7], [8, 6, 5, 4], [queen, 5, 4]), % north |
|
|
478 |
hand([10, 9, 8, 5], [10, 6, 4, 3], [ace, 7], [ace, 6, 2]), % east |
|
|
479 |
hand([king, 2], [ace, king, jack], [king, queen, jack, 10], [queen, 10, 9, 8]), % south |
|
|
480 |
%west north east south |
|
|
481 |
[-, -, -, bid(1, diamonds), |
|
|
482 |
bid(pass), bid(1, hearts), bid(pass), bid(2, no_trump), |
|
|
483 |
bid(pass), bid(3, no_trump), bid(pass), bid(pass), |
|
|
484 |
bid(pass)]). |
|
|
485 |
|
| 456 |
:- end_tests(follow1). |
486 |
:- end_tests(follow1). |
| 457 |
|
487 |
|
| 458 |
% vim: ft=prolog |
488 |
% vim: ft=prolog |
| |
| |
bidding/follow1.pl
|
| old | new | | |
| 247 |
247 |
% follow_invite_impl(+SelfInfo, +Denomination, ?Bid) |
|
| 248 |
248 |
% Implementation of follow_invite state. |
|
| 249 |
249 |
|
|
| 250 |
|
% pass - fewer than 8 points |
|
|
250 |
% pass - fewer than 8 points (7 for no-trump) |
|
| 251 |
251 |
follow_invite_impl(SelfInfo, Suit, bid(pass)) :- |
|
| 252 |
252 |
points(SelfInfo, Suit, Points), |
|
| 253 |
253 |
Points #< 8. |
|
| 254 |
254 |
follow_invite_impl(SelfInfo, no_trump, bid(pass)) :- |
|
| 255 |
255 |
points(SelfInfo, Points), |
|
| 256 |
|
Points #< 8. |
|
|
256 |
Points #< 7. |
|
| 257 |
257 |
|
|
| 258 |
|
% game - 8+ points |
|
|
258 |
% game - 8+ points (7+ for no-trump) |
|
| 259 |
259 |
follow_invite_impl(SelfInfo, Suit, bid(Level, Suit)) :- |
|
| 260 |
260 |
game(Level, Suit), |
|
| 261 |
261 |
points(SelfInfo, Suit, Points), |
|
| 262 |
262 |
Points #>= 8. |
|
| 263 |
263 |
follow_invite_impl(SelfInfo, no_trump, bid(3, no_trump)) :- |
|
| 264 |
264 |
points(SelfInfo, Points), |
|
| 265 |
|
Points #>= 8. |
|
|
265 |
Points #>= 7. |
|
| 266 |
266 |
|
|
| 267 |
267 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
| 268 |
268 |
% |
|
| |
| |
bidding/follow1.plt
|
| old | new | | |
| 216 |
216 |
try_alone([jack, 8, 5], [jack, 9, 3], [queen, 10, 8, 7, 2], [queen, 4], |
|
| 217 |
217 |
[bid(3, clubs), bid(1, diamonds), bid(1, clubs)], Bid). |
|
| 218 |
218 |
|
|
|
219 |
% raise 2NT to 3NT with even just 7 points |
|
|
220 |
|
|
|
221 |
test(invitational_w4, [true(Bid =@= bid(3, no_trump)), nondet]) :- |
|
|
222 |
try_alone([ace, 8, 4, 2], [queen, 8], [jack, 10, 5, 3], [9, 8, 2], |
|
|
223 |
[bid(2, no_trump), bid(1, spades), bid(1, hearts)], Bid). |
|
|
224 |
|
|
| 219 |
225 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
| 220 |
226 |
% |
|
| 221 |
227 |
% After opener bids a new suit at the 1-level. |
|
| |
| old | new | | |
| 453 |
459 |
try_alone([jack, 8], [king, 2], [ace, jack, 4, 3], [king, queen, 9, 5, 3], |
|
| 454 |
460 |
[bid(2, hearts), bid(2, clubs), bid(1, diamonds)], Bid). |
|
| 455 |
461 |
|
|
|
462 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
|
463 |
% |
|
|
464 |
% Final test. |
|
|
465 |
% |
|
|
466 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
|
467 |
|
|
|
468 |
% For South's hand, the book has: |
|
|
469 |
% hand([king, 2], [ace, king, queen], [king, queen, jack, 10], [jack, 10, 9, 8]) |
|
|
470 |
% which treats jacks as stoppers, which looks dubious and seems to contradict |
|
|
471 |
% other examples. I've swapped the jack with the queen in hearts to make things |
|
|
472 |
% a bit more sane. |
|
|
473 |
|
|
|
474 |
test(full_deal, [nondet]) :- |
|
|
475 |
try_all_bids( |
|
|
476 |
hand([queen, jack, 6, 4, 3], [5, 2], [9, 3, 2], [king, 7, 3]), % west |
|
|
477 |
hand([ace, 7], [jack, 9, 8, 7], [8, 6, 5, 4], [queen, 5, 4]), % north |
|
|
478 |
hand([10, 9, 8, 5], [10, 6, 4, 3], [ace, 7], [ace, 6, 2]), % east |
|
|
479 |
hand([king, 2], [ace, king, jack], [king, queen, jack, 10], [queen, 10, 9, 8]), % south |
|
|
480 |
%west north east south |
|
|
481 |
[-, -, -, bid(1, diamonds), |
|
|
482 |
bid(pass), bid(1, hearts), bid(pass), bid(2, no_trump), |
|
|
483 |
bid(pass), bid(3, no_trump), bid(pass), bid(pass), |
|
|
484 |
bid(pass)]). |
|
|
485 |
|
|
| 456 |
486 |
:- end_tests(follow1). |
|
| 457 |
487 |
|
|
| 458 |
488 |
% vim: ft=prolog |
|
| |
| |