BebopKid Posted September 8, 2007 Report Share Posted September 8, 2007 BebopKid, looks like your shuffle algorithm isn't correct. Try it out. It works. It comes up with the expected results. Anything else? Quote Link to comment Share on other sites More sharing options...
han Posted September 8, 2007 Report Share Posted September 8, 2007 I can't take it anymore, sombody stop me. Quote Link to comment Share on other sites More sharing options...
ralph23 Posted September 8, 2007 Report Share Posted September 8, 2007 BebopKid, looks like your shuffle algorithm isn't correct. Try it out. It works. It comes up with the expected results. Anything else? I think you should email Richard Pavlicek and explain your reasoning and results to him, and then take up writing Bobby Wolff and the bridge editor of the NY Times. Don't pay any attention to the experimental results obtained by Trumpace; you know his simulations can't be right; because they don't match your results. Yours after all come up with the "expected results" (expected from your analysis that is); his doesn't. After Pavlicek understands where he went wrong, and why his calculator and the other bridge calculators and sources are in error on the probabilities, based on your experiments, he'll probably offer you an introduction to them, and that will offer a considerably wider and more public forum. After all, look at the consequence: you've disproved what everyone else thought they knew for a long long time. It's basically the Copernican Revolution in bridge probability theory. You'll be at least as famous as Goren, probably more so. You shouldn't waste another second in getting right on this. Quote Link to comment Share on other sites More sharing options...
jtfanclub Posted September 8, 2007 Report Share Posted September 8, 2007 BebopKid, looks like your shuffle algorithm isn't correct. Try it out. It works. It comes up with the expected results. Anything else? Oh Crap. I didn't even notice how bad this was until now. I made 65,000 deals, of those 27411 deals had 6/3 suit splits between two hands No. No no no no no no NO. You tested when one player has six cards in a suit AND AT LEAST ONE OTHER PLAYER HAS EXACTLY THREE CARDS IN THE SUIT. We want to know when one player has six cards in a suit AND HIS PARTNER HAS EXACTLY THREE CARDS IN THE SUIT. What's the difference? Let's deal out spades six times (this should look familiar by now):1. S: 6 W: 3 N: 2 E: 22. S: 6 W: 2 N: 3 E: 2 <----3. S: 6 W: 2 N: 2 E: 34. S: 6 W: 3 N: 3 E: 1 <----5. S: 6 W: 3 N: 1 E: 36. S: 6 W: 1 N: 3 E: 3 <--- Your algorithm counts ALL SIX: 3 6322, 3 6331.But in Fact, only THREE qualify, #2, #4, and #6: 1 6322, and 2 6331. For the other three, there's a 3 card suit out there, all right, but it's not with partner, so it doesn't qualify. So in other words, you're STILL double counting 6322s. And the reason why your algorithm and your sample came out the same is because YOU MADE THE SAME BASIC ERROR IN BOTH OF THEM. Man, if you still can't see it, I can't help you. Quote Link to comment Share on other sites More sharing options...
jdonn Posted September 8, 2007 Report Share Posted September 8, 2007 Just to try and make sure it happens.... Bebop PLEASE read the post immediately prior to this one, and respond to it directly. Please. I'm begging. It shows why you are wrong. Clearly. You will understand. I promise. Just read it. Quote Link to comment Share on other sites More sharing options...
matmat Posted September 8, 2007 Report Share Posted September 8, 2007 BebopKid, looks like your shuffle algorithm isn't correct. Try it out. It works. It comes up with the expected results. Anything else? I am not a fan of reading other peoples' code. it makes me dizzy :unsure: however, i tried to parse your shuffling code. a few notes.max of 4 interleaving cards is too many. what i recall from a talk i went to on shuffling is that it is usually 1-2 cards that are interwoven. I also expect that probabilities for 1,2, 3 or 4 cards are not equal. also, theory dictates that for a true randomization you need more than 4 shuffles. as a friend of mine put it -- folklore dictates 7 shuffles, but more certainly won't hurt. also, why not just randomize 52 cards into 52 slots instead? what is the benefit of trying to emulate a manual shuffling algorithm? 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. Try it out. It works. It comes up with the expected results. Anything else? Sure. Here is a simple test. Please use your shuffling algorithm to do the following simulation for me. Deal say a 100 hands (or whatever reasonable number of deals you like) Use the generator to calculate: i) the chances that West or North holds the Spade Ace. ii) the chances that East or South holds the Spade Ace. (Note West = hand 0, North = hand 1 in your code, Spade Ace = 51) For a more complex test: Do the above 100 times for say 10 hands each time and average the results. Quote Link to comment Share on other sites More sharing options...
Finch 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. This is grossly unfair.There is nothing wrong with writing your own simulation & shuffling code in Excel, in QuickBasic or in anything else you fancy. It's good practice and very educational. The RND function is not great, but it's perfectly adequate for writing simulations. I've written my own dealer in Excel and it works fine (admittedly not very fast...). Quote Link to comment Share on other sites More sharing options...
Finch Posted September 8, 2007 Report Share Posted September 8, 2007 Because the alternative was revising liquidity management, I had a look at the Excel code you quoted. The hands it is generating look more or less OK, but as others have pointed out where you are going wrong is when you sort the hands & suits, as you end up double-counting some distributions. I took your code and generated 5000 hands from it.[side note: it will work much faster if you turn off screenupdating at the start, turn it on at the end, and use the status bar to show progress rather than a cell] However, I removed the sorting part in the sort_suit and sort_hand subroutines, so that the 'distributions' sheet kept the suits in order clubs, diamonds, hearts, spades; and the hands in order 1,2,3,4. I then did my own summary formulae in Excel (could have put this into the macro but I hate fiddling with other people's code) which counted the size of the club fit between the first two hands - so in the Distributions sheet it had another column filled down with "=MID($A2,2,1)+MID($B2,2,1)" The next column had the break of the spade suit between the two remaining hands"=MID($C2,2,1) & "-" & MID($D2,2,1)" So, for example, the first deal was .AKJT9.32.T65432 JT5432..T974.QJ7 AKQ76.Q652.J865. 98.8743.AKQ.AK98 the first cell of the first column of my summay is 9 (the first two hands have a 9-card club fit); the first cell of the second column of my summary is 0-4 (because the remaining clubs are split 0-4 between the other two hands). I counted how many 9-card club fits there were in 5000 deals (353 in this case), and counted how many times the break was 2-2, 1-3, 3-1, 0-4, 4-0. The answers came to 43%, 49%, 8%. I repeated for diamonds, hearts and spades and the overall percentages were excatly 40%, 50% and 10%. I then didn't look just at the size of the fit, but at how the fit was formed ("=MID($A2,2,1) & "-" & MID($B2,2,1)" For 4-5 or 5-4 fits I got 40%, 51%, 9%For 3-6 or 6-3 fits I got 42%, 49%, 10% Try this or something similar i.e. try taking the raw output from your program without doing the sorting first and seeing what you get - when you get a different answer, have a think about the effect your sorting into descending order is having. Quote Link to comment Share on other sites More sharing options...
sheepman Posted September 8, 2007 Report Share Posted September 8, 2007 Can we have this thread pinned...? Maybe we could start a new comedy section of the forum. Quote Link to comment Share on other sites More sharing options...
Fluffy Posted September 8, 2007 Report Share Posted September 8, 2007 I hope after jtfanclub found the answer twice people will stop saying the same all the time ;). 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. This is grossly unfair.There is nothing wrong with writing your own simulation & shuffling code in Excel, in QuickBasic or in anything else you fancy. It's good practice and very educational. The RND function is not great, but it's perfectly adequate for writing simulations. I've written my own dealer in Excel and it works fine (admittedly not very fast...). Yes, there is nothing wrong with writing your own, it is educational, but for god's sake, at least look at some of the existing well known methods to do that before coming up with your own (that is the main reason for my comment). It is a bad idea if you want use your homegrown version to prove a point and are not willing to listen to others (I assumed he had listened to JTfanclub and corrected his post output method, seems like he didn't). Also, how do you decide a shuffling algorithm is "fine"? By going over a few hands generated? The reason his shuffling algorithm appears to be ok, is that the next shuffle is done on the previously shuffled deck. So his results would actually be dependent on the number of hands he is trying to generate. Please try moving the Call start_deck line of code into the simulation loop (which should not effect the randomness of generated hands, if his shuffle code is "ok") and see the results... There are really good and free deal generators out there. It is much better to use them. Or at least if you want to write your own, follow some of the standard methods which are proven to be correct. Sorry for the bad analogy, but it is like prescribing yourself medicines when we have a perfectly good doctor who knows better. If he had followed some of the standard methods, I would not have made that (I admit, a little harsh) comment. Also, I have already apologised to him on the other thread he has started. Quote Link to comment Share on other sites More sharing options...
ralph23 Posted September 8, 2007 Report Share Posted September 8, 2007 You can use the Pavlicek calculator if you are in doubt, and then argue with Pavlicek about it. But Pavlicek is correct as is jdonn (close enough for Govt work anyhow ;) ). The correct odds appear many times on the Internet though and they will in bridge books also. Those odds are not taking into account the actual layouts of 52 cards. They are using a simplistic method which may be close you for, but not close enough for me or the experts and world class players that I've taken lessons from. Check the Encyclopedia of Bridge. We have a hard copy at our Bridge House, come by and I'll show you :) . It will verify the numbers I gave you. What was that page in the Encyclopedia of Bridge to verify the numbers you gave? I can't seem to find it... I only found Harald's example. Maybe I have an outdated edition ?? Quote Link to comment Share on other sites More sharing options...
cherdano Posted September 11, 2007 Report Share Posted September 11, 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. Fluffy, if you can't see the difference between determining the center of universe in the 17th century and solving a simple probability problem in 2007, I don't know what else can help you, but I will give it a try... Computing probabilities like this is a problem solved hundreds of years ago, loads of mathematicians found various ways to compute it leading to the same answers, thousands or maybe even millions have learned how to do it and and convinced themselves that this is the right way to do it. It is such a trivial problem that it is just impossible for millions of mathematicians to have agreed on a wrong method of computing odds like this. Compare this to the 17th century when there was little evidence one way or another, just an observation by Galileo that it might be easier to explain the movements we see on the sky if we assume the sun is the center of the universe, and the RELIGIOUS SCHOLARS NOT ASTRONOMERS were the ones protesting. I admit I am losing some patience about the fact that we have to read so much math-nonsense on BBF. 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.