In a bridge game, a deck of 52 cards (13 spades , 13 clubs, 13 diamonds, 13 spades) are dealt to 4 players (13 cards each) then game starts.Game session ends after 13 tricks each having 4 cards.There are 28561 possible non repeated 4 card groups.

What is the best method of generating and storing all possible trick combinations (played according to the bridge rules just for one session) to be further processed by a computer program (i.e., data structures such as game trees, and any open source algorithms written for any computer language if any).

All resources to read to get the theory behind or any references are welcome. Thank you.

  • 3
    $\begingroup$ There are too many of them, in fact at least $13! \approx 6 \times 10^9$, which is still somewhat reasonable but probably a substantial underestimate. (I get $13!$ since at each trick, the player who leads can choose any of her remaining cards.) $\endgroup$ Commented Dec 27, 2012 at 13:08
  • 2
    $\begingroup$ In the extreme case where one person has all the clubs, another all the hearts, a third all the spades, and the fourth all the diamonds, then the number of trick combinations is $(13!)^4$, even though it's trivial to figure out who wins the hand. $\endgroup$
    – Peter Shor
    Commented Dec 28, 2012 at 5:39
  • 3
    $\begingroup$ This is a very vague question. What does "to be further processed" mean (and the 'best' method probably depends on it, don't you think)? In any case, have you consider looking at the papers behind GIB (the double dummy solver by Matt Ginsberg)? $\endgroup$
    – Aryabhata
    Commented Dec 29, 2012 at 5:09
  • 1
    $\begingroup$ perhaps you can study bidding in Bridge hands? $\endgroup$ Commented Sep 2, 2013 at 14:05

1 Answer 1


If the data is really a tree graph, then maybe a Prüfer code?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.