You might also add a playing-trick criterion, which is surprisingly easy 
to calculate:

For each card, calculate t =. the number of higher cards not held.  Then set

t =. t + 3 4 5 I. c    where c is the number of cards in the suit.

The number of playing tricks for the card is then 1/3 * 0 >. 3 - t .
Sum to get total for the hand.

Henry Rich

On 1/9/2012 11:33 PM, Nick Simicich wrote:
> Many years ago, I wrote a constrained bridge hand generator.  This is the
> problem:
>
> Bridge is an interesting game.  You play and you learn clues about the
> other hands.  These clues become constraints in how the other hands can
> appear.
>
> You also know what cards appear in your hand, and you are sure about them.
>
> When you "count points", you count aces as 4, kings as 3, queens as 2,
> jacks as 1.  There are High Card Points, and points which include
> distribution (or long cards in a suit, same things.
>
> A void is worth three points, a singleton is worth 2 points, and a
> doubleton is worth one points.
>
> Now suppose your partner opens one spade.  They promise 13+ points, and 5
> or more spade.
>
> You have five diamonds, two spades. and 11 points.  Can you make three no
> trump?  Four spades?
>
> You bid two diamonds, and your partner bids two spades.  So they have a
> minimum hand, 13-16 points, and 5 spades, and so fourth.  Should you raise
> them to three?  Just bid four?
>
> Someone suggested:  Make a program that will deal 100 bridge hands and make
> them all match those constraints.  13-16 points, and five spades - and
> also, since the opponents didn't bid against you, presume that they can't
> have 13 points in either hand. or 10 points and a five card suit.
>
> So I wrote a program in IBM Basic that dealt these hands, thousands of
> them, and filtered out the ones that didn't match the constraints..
>
> Anyone want to write a "constrained hand generator" in J?  First off, one
> hand should be specified, then the others should be able to be constrained
> in
>
> (1) point card range.  High, low, both, and it should be possible to be
> open ended.
>
> (2) distribution.  At least x in any suit, at most x cards in a suit, a
> minimum of x points in a suit.
>
> (3) no trump distribution.  When you open or relay no trump, you promise a
> balanced hand.   A balanced hand can be 4-3-3-3, 4-4-3-2 (and if more than
> 18 HCP points the doubleton must have an honor).  You can also have 5-3-3-2
> distribution if the 5 card suit is clubs or diamonds.  You can't have two
> doubletons, a singleton, a void, or a 5 card heart or spade suit (some
> people consider this optional.
>
> Why write this program?
>
>
> So, suppose you open one no trump.  Your partner bids two clubs, you bid
> two diamonds.  Your partner knows that you have, 15-17 HCP, a balanced
> hand, and a maximum of 3 hearts and 3 spades.  You know a lot of
> information.  You can pass 2 diamonds (if you have a lot of diamonds, like
> 5, since partner might have 2 diamonds).  Your partner is supposed to
> "place" the contract.  There is a bonus for playing at 3 NT, 4 hearts or
> spades, or 5 clubs or diamonds, so you want to bid up to those levels if
> you can so reasonably.
>
> But what might partner have?
>
> What do your opponents have?
>
> Partner might get a constraint list like, "NT,>: 15 HCP,<:17 HCP.<4 S,
> <4 H"
>
> You know what you have, you might have S: A984, H: K65 D: QJ985 C: 6
>
> What do you bid?  Opposite some hands, this might make 5 diamonds,
>   opposite others, 2D is a good contract.  With a club stopper, 3 NT might
> be a possibility.
>
> The point is to generate 100 hands that meet the criteria, and then analyze
> them.  How many of those hands will make which of those contracts?
>
> When I used this program, I'd write down my hand and what I knew about the
> others.  Then I'd generate 100 constrained hands (depending on constraints,
> it might take many thousands of trials) and I'd look at those trials.  Was
> I right in my decision...did most hands make the contract I thought about
> bidding, given the constraints?
>
> Anyone want to take a whack at a constrained hand generator?
>
> You need to generate the hands from a list of 39 residual cards and either
> force the points and distribution to be correct or filter for them.
>
> Finally, it is possible that the constraints can't be met.  For example,
> there are 40 HCP in the deck, and you might have a hand that holds 3 HCP
> and you might constrain your partner to<15 HCP, and the opponents<  13
> points.  If that happens, you should either note the error or you should
> "believe your partner" and disbelieve your opponents.
>
>
> Anyone want to take a whack at this?  Presume that analysis will be done
> manually...
>
> On Fri, Jan 6, 2012 at 5:04 AM, Linda Alvord<lindaalv...@verizon.net>wrote:
>
>>
>>
>> -----Original Message-----
>> From: David Ward Lambert [mailto:b49p23t...@stny.rr.com]
>> Sent: Thursday, January 05, 2012 12:44 PM
>> To: Linda Alvord
>> Subject: jsoftware bridge deal challenge
>>
>> NB. Our doles are similar
>> NB. The LA versions contain more 4s, 13s and 52s
>> NB. therefor the DWL versions are more general.
>> NB. doledwl is hard coded for 4 hands.
>>
>> 's c'=: ;:'shdc AKQJT98765432'
>> vdeckdwl=: [: |: [: ,/ ,"0~/
>> deckdwl=: s vdeckdwl c
>> mixdwl=: ({~ [: ?~ #)"1
>> doledwl=: [: |:"2 [: ({~ [: |: _4 [\ [: i. #) |:
>>
>> NB. number_of_hands doledwl2 deck
>> NB. works for number of hands as a factor of the number of cards
>> doledwl2=: 4&$: :(4 : '([: |:"2 [: ({~ [: |: (-x) [\ [: i. #) |:)y')
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to