BBO Discussion Forums: matchpoints declarer play - BBO Discussion Forums

Jump to content

  • 5 Pages +
  • « First
  • 3
  • 4
  • 5
  • You cannot start a new topic
  • You cannot reply to this topic

matchpoints declarer play probabilities

#81 User is offline   matmat 

  • ded
  • PipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 3,459
  • Joined: 2005-August-11
  • Gender:Not Telling

Posted 2007-September-07, 23:29

BebopKid, on Sep 7 2007, 11:22 PM, said:

Trumpace, on Sep 7 2007, 11:05 PM, said:

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?
0

#82 User is offline   Trumpace 

  • Hideous Rabbit
  • PipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 1,040
  • Joined: 2005-January-22
  • Gender:Male

Posted 2007-September-08, 01:02

BebopKid, on Sep 7 2007, 11:22 PM, said:

Trumpace, on Sep 7 2007, 11:05 PM, said:

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.
0

#83 User is offline   FrancesHinden 

  • Limit bidder
  • PipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 8,482
  • Joined: 2004-November-02
  • Gender:Female
  • Location:England
  • Interests:Bridge, classical music, skiing... but I spend more time earning a living than doing any of those

Posted 2007-September-08, 04:48

Trumpace, on Sep 8 2007, 05:05 AM, said:

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...).
0

#84 User is offline   FrancesHinden 

  • Limit bidder
  • PipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 8,482
  • Joined: 2004-November-02
  • Gender:Female
  • Location:England
  • Interests:Bridge, classical music, skiing... but I spend more time earning a living than doing any of those

Posted 2007-September-08, 05:32

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.
0

#85 User is offline   sheepman 

  • PipPip
  • Group: Members
  • Posts: 46
  • Joined: 2006-March-27
  • Location:oop north, England

Posted 2007-September-08, 06:10

Can we have this thread pinned...?

Maybe we could start a new comedy section of the forum.
0

#86 User is offline   Fluffy 

  • World International Master without a clue
  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 17,404
  • Joined: 2003-November-13
  • Gender:Male
  • Location:madrid

Posted 2007-September-08, 09:52

I hope after jtfanclub found the answer twice people will stop saying the same all the time ;).
0

#87 User is offline   Trumpace 

  • Hideous Rabbit
  • PipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 1,040
  • Joined: 2005-January-22
  • Gender:Male

Posted 2007-September-08, 11:50

FrancesHinden, on Sep 8 2007, 05:48 AM, said:

Trumpace, on Sep 8 2007, 05:05 AM, said:

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.
0

#88 User is offline   ralph23 

  • PipPipPipPipPip
  • Group: Full Members
  • Posts: 701
  • Joined: 2007-July-11

Posted 2007-September-08, 12:06

BebopKid, on Sep 6 2007, 03:16 PM, said:

ralph23, on Sep 6 2007, 01:51 PM, said:

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 ??
Philosophy consists very largely of one philosopher arguing that other philosophers are all jackasses. He usually proves it, and I should add that he also usually proves that he is one himself. H.L. Mencken.
0

#89 User is offline   cherdano 

  • 5555
  • PipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 9,516
  • Joined: 2003-September-04
  • Gender:Male

Posted 2007-September-10, 23:38

Fluffy, on Sep 7 2007, 12:41 PM, said:

Trumpace, on Sep 7 2007, 06:35 PM, said:

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.
The easiest way to count losers is to line up the people who talk about loser count, and count them. -Kieran Dyke
0

  • 5 Pages +
  • « First
  • 3
  • 4
  • 5
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users