Long Playing Card Configurations in Beggar Your Neighbor

Long Playing Card Configurations in Beggar Your Neighbor

Warning: This is probably one of the most boring pages ever created. I generated the data for this page as part of a contest I entered in 1991. On the slight chance that anyone is ever interested I figured I might as well put it on the net. Incidentally, I came in second place in this contest and won a year's subscription to a journal.

Beggar Your Neighbor (also know as Beggar Thy Neighbor or Beggar My Neighbor) is a British card game for two people. It's similar to the kid's card game War, where the winner is pre-determined by the deal and no skill is involved. The game is played by Pip and Estella in the book "Great Expectations" by Charles Dickens.


The rules are very simple and are summarized here:

The Setup:

A standard deck of cards is fully dealt between the two players. A person is chosen to start play and from then on the players alternate.

The Play:

The person whose turn it is (player1) takes the top card off of his deck and places it face up in the middle of the playing area onto the trick stack. If this card is a normal card (from two to ten), play passes to the next player (player2).

If the card is a court card (Jack, Queen, King, or Ace), then things get a bit more interesting. Player2 now must place up to a predetermined number of cards on the trick stack. The number is determined by the court card played by the previous player (one for a Jack, two for a Queen, three for a King, four for an Ace). He plays cards one by one off of his deck. If each one is a normal card, then as soon as he's done playing these cards, his opponent (player1) takes the trick stack, places it on the bottom of his deck, and plays again. If while playing the cards, player2 plays a court card himself, then the other player (player1) is in the same position as player2 was after player1 played the first court card.

The first person who runs out of cards is the loser, and the other player takes any cards in the trick stack.

Another explanation of the rules is available at a site associated with the book "Great Expectations".


In November of 1991, Chris Long initiated a contest to see who could find the initial hand that would go the highest number of rounds before the game ended. A round was counted whenever the trick stack was picked up. I believe his interest was to find if it was possible for there to be a card configuration where there was a cycle so that the game would never end.

I wrote a program to churn through random hands, playing them out and keeping track of how many rounds each resulted in. The contest ran for about 6 weeks, and I managed to find one that went 703 rounds. It turned out that I came in second to someone who found one that went 706 rounds. I later improved my program a little and have run it occasionally in the background on my computer. I have since found two initial deck configurations that result in a game going 769 rounds and lots of others that are shorter than that but still very long. I'm quite sure that the 769 round games are the longest ever found. I thought I'd make them available on the net on the off chance that anyone's interested.

I've actually run two separate programs. One generates purely random hands, while the other generates hands that have about the same number of court cards in each hand. The second tends to generate somewhat longer running deals on average.

With the program that generated purely random hands, I kept track of the length in rounds of each game. After analyzing 369,400,000,000 games, here are some interesting statistics: The most common number of rounds for a game is 11, which happens 2.70150068% of the time. In 0.00001602% of the time, the game ends after only one round! I've put an example of one of these one round games at the bottom of this page. Just over 50% of the time, the game ends after from 6 to 28 rounds. Incidentally, the total number of possible deals that are distinct from the game's point of view (swapping a 9 of hearts and a 2 of clubs wouldn't change the outcome) is 653,534,134,886,878,245,000. It's equal to 52!/(4!*4!*4!*4!*36!), which is the number of permutations of 52 cards divided by the number of permutations of the aces and of the kings, and of the queens, and of the jacks, and of the other cards.

In total, my programs played through 738,640,000,000 randomly generated games. Below are all of the ones I found where the resulting games go on for 700 rounds or more. The deck order is top to bottom. Aces, Kings, Queens, and Jacks are denoted by 'A', 'K', 'Q', 'J', respectively, and all other cards are denoted by a '0'.

Tricks taken   = 769
Winning player = 2
Player 1 Deck  = 00000J000Q000A00JJ00QKQ000
Player 2 Deck  = K00AK000000A00A00K0Q0J0000

Tricks taken   = 769
Winning player = 1
Player 1 Deck  = A000Q00JQ00A000J00000Q000K
Player 2 Deck  = A0JJKK00A00000Q00000000K00

Tricks taken   = 757
Winning player = 1
Player 1 Deck  = 00000QKJ0J0JK00QA0000J0Q0Q
Player 2 Deck  = 000000K000000000AAK0000A00

Tricks taken   = 746
Winning player = 1
Player 1 Deck  = 0A0Q00JAA00Q000000J0K000KK
Player 2 Deck  = 000J00000Q00000000K000JQA0

Tricks taken   = 734
Winning player = 1
Player 1 Deck  = Q00A0K000A0J000K00Q0000K00
Player 2 Deck  = Q00J0000Q0JJ00000A0K000A00

Tricks taken   = 731
Winning player = 1
Player 1 Deck  = 00K0K0J000000J00QA00A0000J
Player 2 Deck  = A0JK0000000QQ0000Q000KA000

Tricks taken   = 728
Winning player = 2
Player 1 Deck  = 0QQ0A0000Q000KJA000J000000
Player 2 Deck  = 00000000JKK0A00JK000A0Q000

Tricks taken   = 727
Winning player = 2
Player 1 Deck  = 00K0000000Q00J0A000Q000JKJ
Player 2 Deck  = 0A0K000Q000J00Q0A00K0000A0

Tricks taken   = 726
Winning player = 2
Player 1 Deck  = Q0Q0K000JJ0J00K00000000000
Player 2 Deck  = 000K0A00K0000J0QA0Q0000AA0

Tricks taken   = 722
Winning player = 2
Player 1 Deck  = 0000JJA000A00K00000000KQ0A
Player 2 Deck  = AK00000J000000J0Q0K000Q0Q0

Tricks taken   = 718
Winning player = 1
Player 1 Deck  = 000000QJ00K0K0Q0Q0J0000000
Player 2 Deck  = J0A0A00000000KA0QJ000A0K00

Tricks taken   = 714
Winning player = 2
Player 1 Deck  = 000000QQ000A00J000K000K0JA
Player 2 Deck  = 0000000K0000Q00JA0A00JK00Q

Tricks taken   = 713
Winning player = 1
Player 1 Deck  = A000K000J0KJ00JJ0000000Q0K
Player 2 Deck  = QQ000K000A0Q00A00000000A00

Tricks taken   = 713
Winning player = 1
Player 1 Deck  = 00Q000000QK0A0J00A0J0000A0
Player 2 Deck  = KQKQ00J00J0K0000000000000A

Tricks taken   = 713
Winning player = 2
Player 1 Deck  = 000Q000JK0000000JAQ00000A0
Player 2 Deck  = 000000Q0KQK0000AAK0000J0J0

Tricks taken   = 712
Winning player = 1
Player 1 Deck  = A000000QJ0A0000000000J0K0A
Player 2 Deck  = 0AQQK0000J00000JK0000KQ000

Tricks taken   = 712
Winning player = 1
Player 1 Deck  = 000A000A0J000QA0Q0K000K0A0
Player 2 Deck  = JK0JK0JQ0000Q0000000000000

Tricks taken   = 708
Winning player = 1
Player 1 Deck  = 00A00JAK000J00K000000Q00A0
Player 2 Deck  = 000A00Q00KJ000QK000J0000Q0

Tricks taken   = 707
Winning player = 2
Player 1 Deck  = J00KQ000000000QA0K0000A00J
Player 2 Deck  = KK0J0000000QJ0AQ00A0000000

Tricks taken   = 706
Winning player = 1
Player 1 Deck  = 000A000J00000000KJ00JQA0AK
Player 2 Deck  = 00000000QJ0000QK0QK000000A

Tricks taken   = 704
Winning player = 1
Player 1 Deck  = AQ000000J00000J0K0Q0Q00000
Player 2 Deck  = 00AK0Q00JJ000000000K0A0A0K

Tricks taken   = 703
Winning Player = 2
Player 1 deck  = 00KQ0Q0JA0KJ000Q000A000A00
Player 2 deck  = 000Q0000J00000A00JK0K00000

Tricks taken   = 701
Winning player = 1
Player 1 Deck  = 00JA00Q000K0JA0000000K00A0
Player 2 Deck  = 0K0000Q0JJQ00000000QAK0000

Tricks taken   = 701
Winning player = 2
Player 1 Deck  = 0A000J0J000AK000J00A000KK0
Player 2 Deck  = JA0000Q00QK00000Q00Q000000

Here are four examples of configurations where one of the players wins by taking all of the other's cards in the first round:

Tricks taken   = 1
Winning Player = 1
Player 1 deck  = 0000000K00Q000J00Q00JQK000
Player 2 deck  = 00000000K0AA0AQJA000000KJ0

Tricks taken   = 1
Winning Player = 1
Player 1 deck  = 0000000000000KA00J0JJ0K00Q
Player 2 deck  = 0000000000000Q00AKKA0AQJQ0

Tricks taken   = 1
Winning Player = 2
Player 1 deck  = 0000000000KA00Q00KAAQ0J00Q
Player 2 deck  = 000000000J00J00KA0Q0K000J0

Tricks taken   = 1
Winning Player = 2
Player 1 deck  = 0000000000A0Q00JAKKQ00A0J0
Player 2 deck  = 000000000000Q0KK0J0J0Q0A00

4,365 visits (3 today, 9 this week, 38 this month, 622 this year) since October 19, 1999.

Back to my homepage.

Copyright 1999 by Truman Collins
For comments, email: Truman Collins (truman@tkcs-collins.com)
Most recent update: January 5, 2005
http://www.tkcs-collins.com/truman/byn/byn.shtml