Fluffy Posted September 7, 2007 Report Share Posted September 7, 2007 The notion that the distribution of the 9 known cards between the two known hands should alter the odds is.....I haven't got words. This is true for hand-dealt hands that didn't get shuffled properly. Oh damn, you will alll kill myself for stating this :o Quote Link to comment Share on other sites More sharing options...
Finch Posted September 7, 2007 Report Share Posted September 7, 2007 I went through some crude analysis with han but it seemed like crossing and finessing was definitely a better MP line than cashing spade ace, crossing, and leading a spade up Maybe we should split this thread into two... You are right that crossing and taking a spade finesse, compared with SA, cross, spade up is going to win, because you gain every time spades are 2-2 with the king onside, and you only lose to singleton king offside which is obviously much less likely. What's insteresting is to think of the Ace of spades, cross, jack of clubs line. Suppose we cash the SA, cross, run the CJ, play a second club. Compared to crossing in diamonds and taking a spade finesse. - loses one trick to Kx of spades onside (20%)- loses one trick to Kx of spades offside with Kxx in clubs (4%) [assuming they find the ruff]- loses one trick to K9xx clubs offside and Kxx spades onside (1%) - gains one trick to Kx or Kxx of clubs onside with all 3-card spade holdings offside (25% * 43%) = 11%- gains one trick to singleton SK offside and CK wrong (about 3%)- gains two tricks to singleton SK offside and CKx or Kxx onside (about 2%)- gains one trick to Kx of spades offside and K9xx clubs onside (a bit under 1%)- gains one trick to KJ10x of spades offside and CK onside, not to 4 (about 2%)- gains one trick to Kx of clubs onside with Kxx of spades (4%) 4-0 spades onside is a bit complicated, as you have to decide what to play for That makes the spade finesse line very slightly superior, but some of my sums are a bit approximate, so I'm not yet certain. At imps, by the way, it's definitely right to cash the SA first, as that guards against going off with KJ10x spade foul and the club finesse right. And it clearly doesn't lose a great deal in terms of trick expectation. Now how about SA, cross, CJ, spade? I don't like this, because RHO can cover the club whenever he has KJx of spades, and not cover the club whenever he has Kxx and you never win. Quote Link to comment Share on other sites More sharing options...
Finch Posted September 7, 2007 Report Share Posted September 7, 2007 joshs has also looked at the other line of Ace-and-another-trump, and seems to come to similar conclusions (the odds are very close but the spade finesse is fractionally better). Maybe I conclude that the only line that's clearly wrong is SA, DK, Spade up and anything else is not worth more brainpower. Quote Link to comment Share on other sites More sharing options...
Free Posted September 7, 2007 Report Share Posted September 7, 2007 Well, to be honest, thats what I thought originally, but, The percentages you list (which are the ones normally given) are for all combined holdings of 9 cards (missing 4 cards). A little further crazy thought says, the percentages for a 5-4, 6-3, 7-2, 8-1 and 9-0 breaks are likely different from each other though, no? What a load of crap! What's the difference if you switch 2 ♠s from one hand with 2♣s from the other hand? Distributions are different, splits remain exactly the same since opps still have the same cards... Quote Link to comment Share on other sites More sharing options...
BebopKid Posted September 7, 2007 Report Share Posted September 7, 2007 There are numerous ways to calculate this, but the most easily understood by people with little math background would be the following: Since I have over 20 hours of college math, I didn't use the non-math method. What university, who was the professor and what grade did you get? Did the math include probability theory? Sorry, this statement of yours is quite annoying. You don't have to answer the questions above, but making statements like these to try and support your argument only shows that you don't have a convincing logical argument which is pertinent to the discussion at hand. When I have already stated the Math as my argument, and no one seems to understand that, I have not much more to argue. I'm looking at the evidence, and see clearly that my method for the distribution of the cards fits in with the probability theory. I have explained my method. I've even tested it in practice. I've then looked at the evidence from the test which matches the probabilities that I generated using probability theory. It's staring me right in the face, so yes the Earth does revolve around the Sun. "E pur si muove." Quote Link to comment Share on other sites More sharing options...
Finch Posted September 7, 2007 Report Share Posted September 7, 2007 Maybe, just maybe, when absolutely everybody tells you that you are wrong - including a number of people with maths degrees - it might be a good idea to get your head of the sand and have a bit of a re-think. There are plenty of books and websites around giving the probability of 2-2, 3-1, 1-3, 4-0 and 0-4 breaks. Now, I agree it's possible that they are ALL incorrect.But do you really think that's likely? Quote Link to comment Share on other sites More sharing options...
jtfanclub Posted September 7, 2007 Report Share Posted September 7, 2007 When I have already stated the Math as my argument, and no one seems to understand that, I have not much more to argue. It's not even hard to understand where your error is. "6322 occurs 5.642490% of all hands (~54.2%)6331 occurs 3.448188% of all hands (~33.1%)6430 occurs 1.326226% of all hands (~12.7%)" But not all 6332s, 6331s, and 6430s count. We don't need to include the case where EAST has 6 and WEST has 3, right? I think that one's right out. South has to always have 6, right? That's 3/4 of the hands that we can pitch. So in each case, if South has 6... 6322: Can be- S6, W3, N2, E2S6, W2, N3, E2 <----S6, W2, N2, E3 Only that one 6322 is possible (out of 3), as the others we know can't be true, as North has 3 cards. Therefore, only 1/12 of 6322s fit. 6331: Can be-S6, W1, N3, E3 <----S6, W3, N1, E3S6, W3, N3, E1 <---There are two 6331s possible (out of 3), so 1/6 of the 6331s fit. 6430: Can be-S6, W4, N3, E0 <----S6, W4, N0, E3S6, W3, N4, E0S6, W3, N0, E4S6, W0, N4, E3S6, W0, N3, E4 <--- There are two 6430s (out of six, not out of 3), so 1/12 of the 6331s fit. 1/12 of the 6322s is .470275% (40.70%)In other words, in .47% of all deals we have a 6322 with South having 6 and North having 3.1/6 of the 6331s is .574698% (49.74%)1/2 of the 6430s is .1105188% (9.565%) Which is EXACTY the same numbers as Pavlicek got. Your source and their source agree that you are wrong. My mistake earlier was forgetting that while there's only 12 possible combinations of 6331 and 6322, there are in fact 24 possible combinations of 6430, because there are no duplicate numbers. Sorry about that! The method was right, I just couldn't count. Quote Link to comment Share on other sites More sharing options...
ralph23 Posted September 7, 2007 Report Share Posted September 7, 2007 There are numerous ways to calculate this, but the most easily understood by people with little math background would be the following: Since I have over 20 hours of college math, I didn't use the non-math method. What university, who was the professor and what grade did you get? Did the math include probability theory? Sorry, this statement of yours is quite annoying. You don't have to answer the questions above, but making statements like these to try and support your argument only shows that you don't have a convincing logical argument which is pertinent to the discussion at hand. When I have already stated the Math as my argument, and no one seems to understand that, I have not much more to argue. I'm looking at the evidence, and see clearly that my method for the distribution of the cards fits in with the probability theory. I have explained my method. I've even tested it in practice. I've then looked at the evidence from the test which matches the probabilities that I generated using probability theory. It's staring me right in the face, so yes the Earth does revolve around the Sun. "E pur si muove." Isn't this simply hilarious? I opined earlier that no one (or no amount of evidence) could convince him he's wrong. Not even the simple comparison of durango and pavlicek, which would have raised at least a clue to .... er, most people :lol: would suffice, so you just must admit he's hopelessly confused. Quote Link to comment Share on other sites More sharing options...
ralph23 Posted September 7, 2007 Report Share Posted September 7, 2007 Maybe, just maybe, when absolutely everybody tells you that you are wrong - including a number of people with maths degrees - it might be a good idea to get your head of the sand and have a bit of a re-think. There are plenty of books and websites around giving the probability of 2-2, 3-1, 1-3, 4-0 and 0-4 breaks. Now, I agree it's possible that they are ALL incorrect.But do you really think that's likely? Doesn't matter. You might as well argue with someone from the Flat Earth Society. :lol: Maybe he'll email one of the world class teachers he had, but I doubt it. Evidence is irrelevant. Quote Link to comment Share on other sites More sharing options...
bid_em_up Posted September 7, 2007 Report Share Posted September 7, 2007 Maybe, just maybe, when absolutely everybody tells you that you are wrong - including a number of people with maths degrees - it might be a good idea to get your head of the sand and have a bit of a re-think. There are plenty of books and websites around giving the probability of 2-2, 3-1, 1-3, 4-0 and 0-4 breaks. Now, I agree it's possible that they are ALL incorrect.But do you really think that's likely?Where would we be if: Columbus has listened to "everybody"? Newton had gone on about his business like everybody else when the apple fell?The Wright Brothers had listened when told they could not fly?Kennedy had paid attention to those smarter than him who said it was impossible to put mankind on the moon? and countless other similar events in history, where somebody has stopped to question the norm. Much knowledge and advancement of mankind has come directly from asking "What if?" or not taking what is said as gospel, just because everyone says its so. Now, I said it was a "crazy" thought that possibly it might make a difference if the suit split 5-4 or 8-1. I did not claim that the current (and what I also believe to be accurate) probabilities were not accurate, I simply had an admittedly crazy "What if" thought. But while you say: Maybe, just maybe, when absolutely everybody tells you that you are wrong - including a number of people with maths degrees - it might be a good idea to get your head of the sand and have a bit of a re-think. I, say, maybe, just maybe when everybody else is telling you something can't be done or isn't possible, or it simply has to be that way, it might be a good time to think harder about how to go about proving them to be incorrect. Mind you, I am not saying they are incorrect. But if you always simply blindly accept statement of the sorts being made here, then advancements cease to be made. "Always listen to experts. They'll tell you what can't be done, and why. Then do it." -- Lazarus Long, Time Enough for Love (Amusing that Ralph mentions the Flat Earth society, in defense of the other sides opinion. I see it as exactly the opposite. Everybody else would be the Flat Earth Society in Columbus's time, while Bebop would be Columbus.) Quote Link to comment Share on other sites More sharing options...
Trumpace Posted September 7, 2007 Report Share Posted September 7, 2007 Maybe, just maybe, when absolutely everybody tells you that you are wrong - including a number of people with maths degrees - it might be a good idea to get your head of the sand and have a bit of a re-think. There are plenty of books and websites around giving the probability of 2-2, 3-1, 1-3, 4-0 and 0-4 breaks. Now, I agree it's possible that they are ALL incorrect.But do you really think that's likely?Where would we be if: Columbus has listened to "everybody"? Newton had gone on about his business like everybody else when the apple fell?The Wright Brothers had listened when told they could not fly?Kennedy had paid attention to those smarter than him who said it was impossible to put mankind on the moon? and countless other similar events in history, where somebody has stopped to question the norm. Much knowledge and advancement of mankind has come directly from asking "What if?" or not taking what is said as gospel, just because everyone says its so. Now, I said it was a "crazy" thought that possibly it might make a difference if the suit split 5-4 or 8-1. I did not claim that the current (and what I also believe to be accurate) probabilities were not accurate, I simply had an admittedly crazy "What if" thought. But while you say: Maybe, just maybe, when absolutely everybody tells you that you are wrong - including a number of people with maths degrees - it might be a good idea to get your head of the sand and have a bit of a re-think. I, say, maybe, just maybe when everybody else is telling you something can't be done or isn't possible, or it simply has to be that way, it might be a good time to think harder about how to go about proving them to be incorrect. Mind you, I am not saying they are incorrect. But if you always simply blindly accept statement of the sorts being made here, then advancements cease to be made. "Always listen to experts. They'll tell you what can't be done, and why. Then do it." -- Lazarus Long, Time Enough for Love (Amusing that Ralph mentions the Flat Earth society, in defense of the other sides opinion. I see it as exactly the opposite. Everybody else would be the Flat Earth Society in Columbus's time, while Bebop would be Columbus.) What you say is totally irrelevant... The problem in question has a clear mathematical proof, unlike the scientific theories of those days which did not have any proof (they were just theories, waiting to be proved/disproved). All we need to do is look at the proof. During the times you mention most people weren't scientific minded, but were just stubborn believers. The times have changed and these days the quite a number of educated people at least have a scientific bend of mind (especially in online forums) and look for the truth instead of proof of what they believe. So if a lot of people disagree with you, there is a good chance you are wrong. btw, good chance does not mean 100%. Also, if we start trying to read the gibberish of every crackpot that comes along, no time would be spent on anything else (judging by the number of such people on the various forums I have visited). These kinds of statements remind of the Calvin and Hobbes comic: Calvin: "You know Einstein's grades were bad when he was a kid, well mine were are worse!" I have seen this happen numerous times, the crackpot says something, many people disagree, the crackpot now instead of rethinking what he said, brings up arguments like these to convince himself that he is a genius... Quote Link to comment Share on other sites More sharing options...
Fluffy Posted September 7, 2007 Report Share Posted September 7, 2007 During the times you mention most people weren't scientific minded, but were just stubborn believers. The times have changed and these days the quite a number of educated people at least have a scientific bend of mind (especially in online forums) and look for the truth instead of proof of what they believe. Looking at Ralph's posts I have my doubts, he seems so convinced that pavlicek or whatever his source is right that he doesn't even contemplate the fact that he might be wrong, he just laughs at Bebop for contradicting the obvious without even thinking. I also see the analogy with Galileo or Columbus the way bid_them_up does. Quote Link to comment Share on other sites More sharing options...
jdonn Posted September 7, 2007 Report Share Posted September 7, 2007 Mind you, I am not saying they are incorrect. But if you always simply blindly accept statement of the sorts being made here, then advancements cease to be made. Lol. BLINDLY?!?! He has been PROVEN wrong like 15 times in this thread! By at least three different valid mathematical methods, and a number of sources including HIS OWN! Bebop, read JT's post about five before this one. It shows you the mistake you were making quite clearly. There is nothing else I can say. Quote Link to comment Share on other sites More sharing options...
Trumpace Posted September 7, 2007 Report Share Posted September 7, 2007 During the times you mention most people weren't scientific minded, but were just stubborn believers. The times have changed and these days the quite a number of educated people at least have a scientific bend of mind (especially in online forums) and look for the truth instead of proof of what they believe. Looking at Ralph's posts I have my doubts, he seems so convinced that pavlicek or whatever his source is right that he doesn't even contemplate the fact that he might be wrong, he just laughs at Bebop for contradicting the obvious without even thinking. I also see the analogy with Galileo or Columbus the way bid_them_up does. Even if ralph is behaving as you say (which I think he is not, he is quoting sources which BebopKid cited and Pavlicek is a well known authority in these matters) it still does not falsify the statement: "Quite a number of educated people have a scientific bend of mind in online forums". It just proves that you aren't one of the ones with a scientific bend of mind, as any statistician will tell you just one example is not enough to falsify that statement. People may strongly believe whatever they want: God exists, a natural 2NT is forcing, or probabilities change depending on distribution of the 9 cards. The strength of the belief does not make them right. Sorry, this thread is getting out of hand, I think I will stop participating. Quote Link to comment Share on other sites More sharing options...
jtfanclub Posted September 7, 2007 Report Share Posted September 7, 2007 Where would we be if: Columbus has listened to "everybody"? Funny story, that. Everybody had known for centuries that the Earth was round. Some of the maps that Columbus was looking at were in Arabic miles, almost twice the size of Italian miles. As a result, Columbus thought that the distance from Europe to Asia Westward was much less than reality, about 3000 (modern) miles instead of the actual 12,000. The reason people laughed at him is because there was no way in hell that he had the supplies to travel 12,000 miles. And they were right. Anyhow, this is a simple mathematical error, that even a middle schooler can figure out. 2/3 of 6331 hands with 6 cards in the South have 3 cards in the North, while only 1/3 of 6322 hands with 6 cards in the South have 3 cards in the North. That isn't to say that BeBop is bad at math, it's just one of those simple mistakes that all of us make. I used 2/3 instead of 2/6 for 6340 myself, after all, so I'm not one to judge. But when you won't look at your own math when people point out an arithmatic error to you, it stops being math, and starts being religion. These flights of fancy into Columbus and the like are amusing, and all, but it's just math. If you seriously think BeBop's right, then you should be able to find the error in my reckoning. By all means, find it. Quote Link to comment Share on other sites More sharing options...
ralph23 Posted September 7, 2007 Report Share Posted September 7, 2007 Where would we be if: Columbus has listened to "everybody"? Funny story, that. Everybody had known for centuries that the Earth was round. http://www.talkorigins.org/faqs/flatearth.html Well..... apparently not EVERYBODY lol. :D The best line I've seen or heard for a long time is on this website: "Please do not send us feedback to tell us that the Earth is a sphere; we are already aware of this fact." Quote Link to comment Share on other sites More sharing options...
Halo Posted September 7, 2007 Report Share Posted September 7, 2007 A very interesting hand is posted and it turns into this..... So what is the right line? My intuitive line is to cross to the DK and hook the spade. I recognize that this is effectively a math problem though so would like those who are good at these things to figure out what is the best line. Sorry if someoen did this and I missed it amongst the noise. As previously posted I agree with the above. I am not sure math is the issue on this hand. In a practical situation I would ignore 40/04. 31/13 balance out. 22 King offside doesn't matter. So Bridge wise (I believe) it comes down to 22 King onside versus stiff king onside and offside. So I still say the the finesse is the correct matchpoint play by a significant margin. Quote Link to comment Share on other sites More sharing options...
BebopKid Posted September 7, 2007 Report Share Posted September 7, 2007 I need some help explaining these numbers. I ran through 400 hands generated by Bridge Baron 16. 200 with NS having 6 spades in North and 3 Spades in South, the opponents hands were17 4-0 split90 3-1 split93 2-2 split 200 with NS having 5 spades in North and 4 Spades in South, the opponents hands were21 4-0 split105 3-1 split74 2-2 split This is closer to my predictions than to Pavlicek's predictions. After so many people telling me I was wrong, I'm confused that the samples conformed somewhat close to my predictions made from my inadequate knowledge of probability theory. Can someone please tell me where I went wrong with the samples? I can give the 400 deal #'s to anyone who would like to verify. Quote Link to comment Share on other sites More sharing options...
han Posted September 8, 2007 Report Share Posted September 8, 2007 I suggest you try a larger number, the error should get smaller then. Quote Link to comment Share on other sites More sharing options...
Stephen Tu Posted September 8, 2007 Report Share Posted September 8, 2007 Or perhaps simply Baron's deal generator when you put in constraints doesn't work correctly and provide true randomness. Try Thomas Andrew's Deal, or van Staveren et al's dealer Quote Link to comment Share on other sites More sharing options...
BebopKid Posted September 8, 2007 Report Share Posted September 8, 2007 Thanks for the suggestion Hannie. And Stephen. I made 65,000 deals, of those 27411 deals had 6/3 suit splits between two hands 14681 split 2-2 (53.56%)9155 split 3-1 (33.40%)3575 split 4-0 (13.04%) 64348 deals had 5/4 suit splits between two hands 33606 split 3-1 (52.23%)27478 split 2-2 (42.70%)3264 split 4-0 (5.07%) Could someone please explain why these deals do not match Pavlicek's calculations but instead match my probability calculations? Quote Link to comment Share on other sites More sharing options...
Trumpace Posted September 8, 2007 Report Share Posted September 8, 2007 I thought I will stay away, but BebopKid's simulation results forced me to respond. I did a simulation of my own, using Deal 3.08. Here are the results: for 5 spades with North and 4 with south with 30,000 deals these are the results: 2-2 split = 12165 (~40.55%)3-1 split = 14971 (~49.9%)4-0 split = 2864 (~9.54%) for 6 spades with North and 3 with south, with 30,000 deals these are the results: 2-2 split = 12231 (~40.77%)3-1 split = 14900 (~49.66%)4-0 split = 2869 (~9.56%) Here is the condition script used:source format/noneset ns 6set ss 3set count 0set ttcount 0set tocount 0set fzcount 0 main { if {[spades north] == $ns && [spades south] == $ss} { set sw [spades west] if {$sw == 2} {set ttcount [expr $ttcount + 1]} if {$sw == 1 || $sw == 3} {set tocount [expr $tocount + 1]} if {$sw == 4 || $sw == 0} {set fzcount [expr $fzcount + 1]} set count [expr $count + 1] accept } reject} deal_finished { puts "Deals = $count" puts "2-2 split = $ttcount" puts "3-1 split = $tocount" puts "4-0 split = $fzcount"} BebopKid, please post the simulation code/method you used. Quote Link to comment Share on other sites More sharing options...
dake50 Posted September 8, 2007 Report Share Posted September 8, 2007 Opponents SILENT with 11 ! ! hearts? Hearts must break 6-5/5-6 with KJ/AJ 5th in last to speak. Factor in the 6331/6322/6340 that only 7/6 slots remain. This reduces the unbalanced cases. I expect 2-2 spades is well over 54% Quote Link to comment Share on other sites More sharing options...
BebopKid Posted September 8, 2007 Report Share Posted September 8, 2007 Excel macro with sheets in the workbook: "Hands", "Distributions", and "Summary" Dim Deck(52) As Integer, DeckS(52) As Integer' DeckS has the hands sorted by suit and rank, so that the Deck remains the unsorted master to retain random distribution' Face value is card mod 13' Suit value is int(card / 13)' Examples: 51 is Ace of Spades, 3 is 4 of ClubsDim Faces(13) As String' Faces contains a map to card ranks Sub start_deck() Dim i As Integer For i = 0 To 51 Deck(i) = i Next i = 0 Faces(i) = "2" i = i + 1 Faces(i) = "3" i = i + 1 Faces(i) = "4" i = i + 1 Faces(i) = "5" i = i + 1 Faces(i) = "6" i = i + 1 Faces(i) = "7" i = i + 1 Faces(i) = "8" i = i + 1 Faces(i) = "9" i = i + 1 Faces(i) = "T" i = i + 1 Faces(i) = "J" i = i + 1 Faces(i) = "Q" i = i + 1 Faces(i) = "K" i = i + 1 Faces(i) = "A" End Sub Sub shuffle()' Perform a realistic shuffleDim Deck1(26) As Integer, Deck2(26) As Integer' Two half decks of equal size to be shuffledDim i As Integer, j As Integer, k As IntegerDim total As Integer, flex As IntegerDim i1 As Integer, i2 As Integer, i3 As IntegerDim pick As Integer total = 4 ' number of shuffles flex = 4 ' maximum cards from each half deck to be shuffled per iteration For j = 1 To total ' Make two half decks For i = 0 To 25 Deck1(i) = Deck(i) Deck2(i) = Deck(i + 26) Next i1 = 0 ' number of cards shuffled so far on this iteration i2 = 26 ' number of cards left in half deck 1 i3 = 26 ' number of cards left in half deck 2 Do While i1 < 52 ' keep shuffling until the deck is full If i2 > 0 Then ' make sure cards are left in half deck 1 pick = Int(Rnd * flex + 1) ' randomly choose number of cards to be shuffled For k = 1 To pick ' add each shuffled card to the deck If i2 > 0 Then i2 = i2 - 1 Deck(i1) = Deck1(i2) i1 = i1 + 1 End If Next End If If i3 > 0 Then ' make sure cards are left in half deck 2 pick = Int(Rnd * 6 + 1) ' randomly choose number of cards to be shuffled For k = 1 To pick ' add each shuffled card to the deck If i3 > 0 Then i3 = i3 - 1 Deck(i1) = Deck2(i3) i1 = i1 + 1 End If Next End If Loop Next End Sub Sub sort_hands()Dim i As Integer, j As Integer, temp As Integer, hand As Integer For i = 0 To 52 DeckS(i) = Deck(i) ' copy deck order to a second eck to be sorted Next For hand = 0 To 3 ' sort by hand For i = 0 + 13 * hand To 12 + 13 * hand - 1 ' use a selection sort to sort by suit and rank For j = i + 1 To 12 + 13 * hand If DeckS(i) < DeckS(j) Then temp = DeckS(i) DeckS(i) = DeckS(j) DeckS(j) = temp End If Next Next NextEnd Sub Function sort_hand(ByVal Cards, idx) As String' break each hand into suitsDim retval As String, hand As Integer, suit As Integer, i As IntegerDim temp As Integer retval = "" For suit = 0 To 2 ' use a modifed selection sort For i = suit + 1 To 3 If Cards(idx, suit) < Cards(idx, i) Then temp = Cards(idx, suit) Cards(idx, suit) = Cards(idx, i) Cards(idx, i) = temp End If Next Next For suit = 0 To 3 retval = retval + Str(Cards(idx, suit)) Next sort_hand = retval End Function Function sort_suit(ByVal Cards, idx) As String' break each suit into handsDim retval As String, hand As Integer, suit As Integer, i As IntegerDim temp As Integer retval = "" For hand = 0 To 2 ' use a modified selection sort For i = hand + 1 To 3 If Cards(hand, idx) < Cards(i, idx) Then temp = Cards(hand, idx) Cards(hand, idx) = Cards(i, idx) Cards(i, idx) = temp End If Next Next For hand = 0 To 3 retval = retval + Str(Cards(hand, idx)) Next sort_suit = retval End Function Sub print_dist(row As Long)' output the distributions to the worksheetDim i As Integer, suit As IntegerDim Hands(4, 4) As Integer, hand As IntegerDim Suits(4, 4) As IntegerDim temp As Integer i = 0 For hand = 0 To 3 'count the distribution of hands For suit = 3 To 0 Step -1 temp = 0 Do While (DeckS(i) >= suit * 13 And i < (hand + 1) * 13) temp = temp + 1 i = i + 1 Loop Hands(hand, suit) = temp Next Next Worksheets("Distributions").Range("A" & row).Value = sort_hand(Hands, 0) Worksheets("Distributions").Range("B" & row).Value = sort_hand(Hands, 1) Worksheets("Distributions").Range("C" & row).Value = sort_hand(Hands, 2) Worksheets("Distributions").Range("D" & row).Value = sort_hand(Hands, 3) Worksheets("Distributions").Range("E" & row).Value = sort_suit(Hands, 3) Worksheets("Distributions").Range("F" & row).Value = sort_suit(Hands, 2) Worksheets("Distributions").Range("G" & row).Value = sort_suit(Hands, 1) Worksheets("Distributions").Range("H" & row).Value = sort_suit(Hands, 0) End Sub Sub print_deal(row As Long)' output the hands to the worksheetDim i As Integer, suit As IntegerDim Hands(4) As String, hand As IntegerDim Suits(4) As String i = 0 For hand = 0 To 3 'insert a decimal character between the suits Hands(hand) = "" For suit = 3 To 0 Step -1 Do While (DeckS(i) >= suit * 13 And i < (hand + 1) * 13) Hands(hand) = Hands(hand) + Faces(DeckS(i) Mod 13) Suits(suit) = Suits(suit) + Faces(DeckS(i) Mod 13) i = i + 1 Loop If suit > 0 Then Hands(hand) = Hands(hand) + "." If hand < 3 Then Suits(suit) = Suits(suit) + "." Next Next Worksheets("Hands").Range("A" & row).Value = Hands(0) Worksheets("Hands").Range("B" & row).Value = Hands(1) Worksheets("Hands").Range("C" & row).Value = Hands(2) Worksheets("Hands").Range("D" & row).Value = Hands(3) Worksheets("Hands").Range("E" & row).Value = Suits(3) Worksheets("Hands").Range("F" & row).Value = Suits(2) Worksheets("Hands").Range("G" & row).Value = Suits(1) Worksheets("Hands").Range("H" & row).Value = Suits(0) End Sub Sub deal()Dim total As Long, i As Longtotal = 65000 'number of dealsCall start_deck 'initialize all 52 cards For i = 1 To total If i Mod 500 = 0 Then Worksheets("Distributions").Range("I1").Value = i ' show progess on the worksheet Call shuffle 'shuffle the cards Call sort_hands 'sort the hands by suit and rank Call print_deal(i + 1) Call print_dist(i + 1) 'print the distribution to the worksheetNext Worksheets("Distributions").Range("A:H").Copy 'copy the distributions Worksheets("Distributions").Range("J1").PasteSpecial 'paste the distributions to the columns where summary formulas are pointed End Sub Quote Link to comment Share on other sites More sharing options...
Trumpace Posted September 8, 2007 Report Share Posted September 8, 2007 BebopKid, looks like your shuffle algorithm isn't correct. What in the world are you trying to do writing your own shuffling code? In order to do simulations, you really need a very very good random number generator. The RND function is a really bad random number generator. Even if it was good, I don't think your shuffle function would generate deals with uniform probability. Basically, your random hand generation code is wrong. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.