Utilizador: Password:
Registo de novo utilizador
Moderador: toedder 
 Computers

Have computer questions, hints, or tips?

BBW's Tips on how to speed up page load the brainking site
Computers (BIG BAD WOLF, 2007-03-12 20:16:01)



Quais são as novidades sobre MP3 players?
Lista de Fóruns
Modo de acesso: Qualquer um pode escrever
Procurar nas mensagens:  

7. Agosto 2006, 10:03:34
Walter Montego 
Assunto: Dealing the four cards up on the first hand in Building
Modificado por Walter Montego (7. Agosto 2006, 10:07:31)
I posted this on the tournament board, but it's really more of a problem for a computer to solve, though it can be done with paper and pen. I'd appreciate any help or ideas for a solution and it might also be a fun type of problem for someone to work on or solve. Or copy it and send to a friend you think might know how to solve it. ==================================
>>

I have something I've not worked on in awhile and I wasn't able to figure it out when I did work on it. I am wondering if you or someone else might be able to point out to me where I'm going wrong, or solve it yourself and show me the numbers for me to check and explain how you did it. At least to its completion with the exact number of possible deals, not approximations. It involves the dealing of the first hand in a game of Building. After the first hand is dealt the dealer faces four cards to the table. Similar to what is done in the game Cassino, if you're familiar with that game as I doubt if you know Building, but it doesn't really matter what game it is to understand this problem. The number of cards dealt to each player is seven if they're playing two handed, but that shouldn't have any baring on it either. You could just take a deck of playing cards made for Building and deal the top four cards off the top to solve this problem. But if you need details to help I will gladly supply them. This might not be exactly on topic for this discussion board, but I am the tournament director and get asked about the deal of the four cards and the odds related to the turning of a Jack or Joker or more when someone is dealing. The other problem related to this one is what are the odds and the number of hands turned up when the four cards can taken in one turn by the non-dealer on his first turn. I'll get to the details of that, if you can help me with the turned up cards first. The clearing of the table, if you or someone else is interested in it, can be done through messages or some other board unless it is appropriate on this one. I can solve it through brute force methods and using the fingers on my hands, I've just never attempted to do it as yet.

Anyways, back to the turning up of the four cards. The deck of cards used to play Building is the 52 standard deck used for Bridge or Poker plus two Jokers, for a total of 54 cards. When the dealer finishes dealing the players their first hand he faces four cards to the table between them. If any of the four cards turned up is a Joker or a Jack, the card or cards are set aside and another is dealt up to replace each one. If the replacement card is also a Jack or Joker, it too is set aside and another card is dealt up. Since there's four Jacks and two Jokers, the maximum number of cards set aside is six. None or one is the common amount, with two happening on occasion. The most I've ever seen is five and I've seen that three times, but then I've played thousands of games of Building. I've never seen all six turned up, but I'm sure it's possible.

What I've had trouble figuring out in this problem is how many different ways can each amount of Jacks and Jokers be turned up exactly. In Five Card Stud Poker there's an exact number of ways you could have a four of a kind dealt to you and it's not 13, but 624. That's always a good one to puzzle people with. There's 40 straight flushes in Poker that are easily countable on one's hands, no calculator required and they think only 13 four of a kinds, so why does a straight flush rank as the higher hand if there's more of them? I'm old school, a royal flush is a straight flush and not a seperately ranked hand as is now commonly shown in Poker charts. The best straight flush, but still just a straight flush.

It's fairly easy to figure out how many times the four cards will not have any Jacks or Jokers. Since there's 6 cards that are Jacks or Jokers, that leaves 48 that aren't. The first turned up could be any of those 48, the second would be one of the 47 left, the third one of the 46, and the fourth one of the 45. Since these can be dealt in any order, you need to divide the product of these numbers by the number of ways one can group 4 things, which is 24.
48 × 47 × 46 × 45 ­­÷ (4 × 3 × 2 × 1) = 194,580
This can be written 48!/4!44! if you have one of them calculators that does the factorials on it. I'm used to paper and pen, but calculators handle big numbers pretty good nowadays with exact numbers and not approximations. Seems like there's a calculator built right into the computer too. Oh yeah, a computer's original use!

OK, that's easy and I'm sure it's the correct and exact amount of different times the four cards can be turned up without a Jack or Joker amongst them. What happens when one one of the four cards is a Jack or Joker?
48 × 47 × 46 × 6 ÷ (3 × 2 × 1 × 1) = 103,776
or written (48!6!)/(45!3!5!1!)
For two I have 48 × 47 × 6 × 5 ÷ (2 × 1 × 2 × 1) = 16920
or written (48!6!)/(46!2!4!2!)
For three I have 48 × 6 × 5 × 4 ÷ (1 × 3 × 2 × 1) = 960
or written (48!6!)/(47!1!3!3!)
For four I have 6 × 5 × 4 × 3 ÷ (4 × 3 × 2 × 1)= 15
or written (6!)/(4!2!)
So far this is easy enough to follow and can be done with some paper and a deck of cards while imagining different ways of cards being dealt or combinations of sets. The numbers themselves are kind of large, so a calculator comes in handy.

The first four cards can have 0 through 4 Jacks or Jokers in the total of all those different ways and there's an easy check for it too.
194580 + 103776 + 16920 + 960 + 15 = 316,251
The check is 54 × 53 × 52 × 51 ÷ (4 × 3 × 2 × 1) = 316,251
or written 54!/(50!4!)
So far nothing complicated once you see how this is done. My problem is what happens when the dealer finishes dealing the cards to have just four cards turned up that aren't Jacks or Jokers. The turning of the cards after the first four is dependent on the card turn up to replace a turned up Jack or Joker. The more Jacks and Jokers turned up, the more complicated it gets. I tried the two extremes, and maybe you can see what it is that I'm not understanding or overlooking.
The case of when just one Jack or Joker is one the first four cards is fairly straight forward. It happens 103,776 times out of 316,251, which happens about 32.8% of the time and is close to 2 to 1 against it in odds. This and the four cards not having any Jacks or Jokers 61.5% cover a little 94% of the four card combinations that can be dealt.

The case of one Jack or Joker in the first four cards:

The dealer sets it aside and deals another card. If it's not a Jack or Joker, he's done dealing the first hand. He shows the non-dealer the one card that was set aside and then faces it on the bottom of the deck for use later in the deal of the other hands remaining. It no longer matters for this problem. This fifth card that he turned up wasn't a Jack or Joker, so it had to be one the remaining 45 cards. This is the beginning of where I get confused in figuring out the exact number of ways this can happen. Should the number of deals where just one Jack or Joker was faced equal 103,776 × 45? Which is 4,669,920? Since it takes five cards to be dealt when this happens, we'll need to figure the case of one Jack or Joker based on a set of 5 cards, right?
Doing it as {48 × 47 × 46 × 6 ÷ (3 × 2 × 1)} × 45 = 4,669,920 is not the same thing as
48 × 47 × 46 × 45 × 6 ÷ 24 = 1,167,480 A quarter of the other number, but exactly the amount of ways one Jack or Joker can dealt out of a deck of 54 cards into a hand of five cards. Not only that, but the first number is larger than the group it comes from which is 3,162,510, the number of sets of 5 in 54 objects, 54!/(49!5!). I'm obviously missing something. This second number, 1,167,480 is the exact number of times just one Jack or Joker will come up in five cards, but is not the right number for this problem because it includes the case of when the first four cards contain no Jacks or Jokers and the dealing stops before a fifth card (The Jack or Joker) would be dealt. For some reason I think subtracting 194,580 from the any of these numbers will not yield the right answer, though it might be the thing to do with 1,167,480 and get 972,900.

The other extreme is taking the first four cards to be all Jacks and Jokers. This happens 15 times out of 316,251. About .0047% of the time at odds of 316,236 to 15 or exactly 21,082.4 to 1 against. Yep, that doesn't happen much. I can't remember if I've ever seen that happen or not. I have seen four Jacks turned up, but that was after turning some replacement cards for some of the earlier Jacks.

The case of all four of the first four cards being Jacks or Jokers:

In this extraordinary event, the dealer (besides smiling and looking forward to the last hand of the deal), would set all four of the cards to the side and turn up four more cards. If none of these four replacement cards are Jacks or Jokers, he's done dealing the first hand. He picks up the four cards set aside and places them face up on the bottom of the deck for use later in the deal during the last hand.
Just how many times can this happen? It'd seem to be 15 × 194,580 which is 2,918,700. I believe this number might be correct for this particular example, but it isn't number for how many times the dealer might turn up exactly 4 Jacks or Jokers. There are a lot of ways that the dealer might indeed turn up exactly 4 Jacks or Jokers while dealing the four cards to the table. He could deal one Jack or Joker and three other cards in the first four cards and then turn up three consecutive Jacks and Jokers as replacements and then a fourth card not a Jack or Joker, or he could turn up 3 Jacks or Jokers in the first four cards and deal in a number a ways just one more Jack or Joker before getting four cards that aren't Jacks or Jokers. I tried to make a tree diagram for these choices in dealing each replacement card when this situation occurs and I went crazy! It's in the archives somewhere as I haven't worked on this in over fifteen years. When I got the tree diagram to the chance of having all 6 Jacks and Jokers turned up on the deal of the first hand, I had branches everywhere and an impossibly high number of occurances for what would be the rarest event of this deal to happen. The branches stop when 4 cards that aren't Jacks or Jokers are dealt, but go on to a possible ten cards if all the Jacks and Jokers we to be dealt.

My brother saw me working on this problem years ago and came up with a solution that I didn't like as it didn't cover every possible deal or have the exact number of deals for each combination of Jacks and Jokers turned up. He just programmed a computer to randomize 54 numbers and then pretend to deal until there was four numbers not 49 through 54. He had the computer tally each deal and then do it again. He had the computer run all night and then gave me the percentage for 0, 1, 2, 3, 4, 5, 6, Jacks or Jokers being dealt. Definitely not a mathematician's answer, but he's an engineer and didn't see why I wanted exact numbers. His approach did give me an idea for counting the number of ways the four cards and the Jacks and Jokers could be determined. Seeing how he did this over twenty years ago and computers are lots faster nowadays, my idea might actually be practical today. Just have the computer methodically count and go through each possible combination of dealing the cards. Since the first four cards when dealt without a Jack or Joker total is known precisely, you could even skip that part and just do the counting from when one or more are turned up.

Anyways, there's my problem and I'd certainly like some help on it and a way to check the numbers. And of course, any new approach to solving it, or how you solved it would be greatly appreciated. Also, if you'd like the details for the clearing of the table's original four cards by the non-dealer or eldest hand, just ask and I'll get it to you.

Thank you for your help

Data e hora
Amigos online
Fóruns favoritos
Clubes
Dica do dia
Copyright © 2002 - 2024 Filip Rachunek, todos os direitos reservados.
Voltar para o topo