BBO Discussion Forums: Law of Symmetry validation - BBO Discussion Forums

Jump to content

Page 1 of 1

Law of Symmetry validation Dealer script

#1 User is offline   pescetom 

  • PipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 7,904
  • Joined: 2014-February-18
  • Gender:Male
  • Location:Italy

Posted 2020-November-29, 08:47

There is an ongoing discussion here about Ely Culbertson's controversial "Law of Symmetry".
I hacked this script to validate it using random deals.
You can plug in a hand shape (say 5-4-3-1) and get the probability that it is replicated in one or more suits.
The results are discussed in the above linked thread.
Please only comment on script bugs or technical issues here.


Dealer that works script:
##
# "Law of Symmetry" Validation
#
############# insert shape of S hand as four numbers below
S_sp = 5
S_he = 4
S_di = 4
S_cl = 0

S_hand = ((spades(south) == S_sp) and (hearts(south) == S_he) and (diamonds(south) == S_di) and(clubs(south) == S_cl))

W_sp = spades(west)
W_he = hearts(west)
W_di = diamonds(west)
W_cl = clubs(west)

N_sp = spades(north)
N_he = hearts(north)
N_di = diamonds(north)
N_cl = clubs(north)

E_sp = spades(east)
E_he = hearts(east)
E_di = diamonds(east)
E_cl = clubs(east)

sp_ok = (W_sp == S_he and N_sp == S_di and E_sp == S_cl)
     or (W_sp == S_he and N_sp == S_cl and E_sp == S_di)
     or (W_sp == S_di and N_sp == S_he and E_sp == S_cl)
     or (W_sp == S_di and N_sp == S_cl and E_sp == S_he)
     or (W_sp == S_cl and N_sp == S_he and E_sp == S_di)
     or (W_sp == S_cl and N_sp == S_di and E_sp == S_he)

he_ok = (W_he == S_sp and N_he == S_di and E_he == S_cl)
     or (W_he == S_sp and N_he == S_cl and E_he == S_di)
     or (W_he == S_di and N_he == S_sp and E_he == S_cl)
     or (W_he == S_di and N_he == S_cl and E_he == S_sp)
     or (W_he == S_cl and N_he == S_sp and E_he == S_di)
     or (W_he == S_cl and N_he == S_di and E_he == S_sp)

di_ok = (W_di == S_sp and N_di == S_he and E_di == S_cl)
     or (W_di == S_sp and N_di == S_cl and E_di == S_he)
     or (W_di == S_he and N_di == S_sp and E_di == S_cl)
     or (W_di == S_he and N_di == S_cl and E_di == S_sp)
     or (W_di == S_cl and N_di == S_sp and E_di == S_he)
     or (W_di == S_cl and N_di == S_he and E_di == S_sp)

cl_ok = (W_cl == S_sp and N_cl == S_he and E_cl == S_di)
     or (W_cl == S_sp and N_cl == S_di and E_cl == S_he)
     or (W_cl == S_he and N_cl == S_sp and E_cl == S_di)
     or (W_cl == S_he and N_cl == S_di and E_cl == S_sp)
     or (W_cl == S_di and N_cl == S_sp and E_cl == S_he)
     or (W_cl == S_di and N_cl == S_he and E_cl == S_sp)

tot_ok = sp_ok + he_ok + di_ok + cl_ok
produce 1000
condition S_hand 

###### uncomment ONE action below ##########
#action printes ("Hand Shape: ",S_sp,S_he,S_di,S_cl," Suits same shape: ", sp_ok,he_ok,di_ok,cl_ok,\n)
#action frequency(sp_ok,0,1)
#action frequency(he_ok,0,1)
#action frequency(di_ok,0,1)
#action frequency(cl_ok,0,1)
action frequency(tot_ok,0,4)

0

#2 User is offline   nullve 

  • PipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 2,299
  • Joined: 2014-April-08
  • Gender:Male
  • Location:Norway
  • Interests:partscores

Posted 2020-November-29, 09:05

I tried to check the law for the (5431) case this morning but decided to not post about it.

Here's the (very ugly) code I posted and deleted 5 minutes ago but now also with a condition so that it has a chance of working :):

Spoiler


One run:

Frequency evidence: :
    0	  333545
    1	  666455
Generated 7719534 hands
Produced 1000000 hands
Initial random seed 1606663368
Time needed   15.969 sec

0

#3 User is offline   hrothgar 

  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 15,488
  • Joined: 2003-February-13
  • Gender:Male
  • Location:Natick, MA
  • Interests:Travel
    Cooking
    Brewing
    Hiking

Posted 2020-November-29, 09:28

Somewhat confused here


From my perspective, the first thing to do is validate that the frequency that the dealer script is producing hand shapes of shape foo corresponds to "reality". (Please note, the reason that I do this is more to check my own coding than any distrust of the Dealer program)

After doing so, I'd do pairwise comparisons and check for independence.
Alderaan delenda est
0

#4 User is offline   pescetom 

  • PipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 7,904
  • Joined: 2014-February-18
  • Gender:Male
  • Location:Italy

Posted 2020-November-29, 10:20

View Posthrothgar, on 2020-November-29, 09:28, said:

Somewhat confused here


From my perspective, the first thing to do is validate that the frequency that the dealer script is producing hand shapes of shape foo corresponds to "reality". (Please note, the reason that I do this is more to check my own coding than any distrust of the Dealer program)

Of course. Just set the shape at the top and comment out the action at the end to see 1000 hands.

View Posthrothgar, on 2020-November-29, 09:28, said:

After doing so, I'd do pairwise comparisons and check for independence.

Could you explain what this involves please?
I did check each of the suits separately and they seemed in the ballpark - the script uses a lot of cut and paste and it would be easy to get one suit wrong somewhere I agree.
I'm directing a tourney now, but later will check that (say) 5-4-3-1 and 1-3-4-5 behave the same.
0

#5 User is offline   hrothgar 

  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 15,488
  • Joined: 2003-February-13
  • Gender:Male
  • Location:Natick, MA
  • Interests:Travel
    Cooking
    Brewing
    Hiking

Posted 2020-November-29, 10:34

Life gets complicated when you are looking at all four hands at once because you have lots of binding constraints.

So, to me at least, it would be more interesting just to look at (say) the South hand and see whether the frequency with which the East hand has the same shape is greater than or less than expected

Maybe I'll code something up in R later today
Probably better suited for this
Alderaan delenda est
0

#6 User is offline   smerriman 

  • PipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 4,027
  • Joined: 2014-March-15
  • Gender:Male

Posted 2020-November-29, 13:40

As mentioned in the other thread, this doesn't validate or disprove the law at all - it's nothing to do with the law.

The law is that the process of imperfect shuffles combined with the groupings of tricks formed by playing out a bridge hand biases the deck.

The most complex part here is coming up with a shuffling algorithm that most resembles real life.

If you had one of those, then perhaps you could shuffle, use robots to play out the hand, shuffle, etc and then after a while (he says 'a few hours', however many deals that would be) see if the tend is towards patterns, which is the whole basis of proving whether the law is true or not.
0

#7 User is offline   pescetom 

  • PipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 7,904
  • Joined: 2014-February-18
  • Gender:Male
  • Location:Italy

Posted 2020-November-29, 13:54

View Posthrothgar, on 2020-November-29, 10:34, said:

So, to me at least, it would be more interesting just to look at (say) the South hand and see whether the frequency with which the East hand has the same shape is greater than or less than expected

But that is not what Culbertson is postulating. He says the shape of the south hand will be replicated in one suit looking at all four hands around the table.
0

#8 User is offline   pescetom 

  • PipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 7,904
  • Joined: 2014-February-18
  • Gender:Male
  • Location:Italy

Posted 2020-November-30, 07:55

View Postpescetom, on 2020-November-29, 10:20, said:

I did check each of the suits separately and they seemed in the ballpark - the script uses a lot of cut and paste and it would be easy to get one suit wrong somewhere I agree.
I'm directing a tourney now, but later will check that (say) 5-4-3-1 and 1-3-4-5 behave the same.


I checked that the order of suit lengths has no effect on the total of matching suits for hand shape foo (by swapping pairs of suits and inverting the whole order, e.g. 5341 5314 1345 instead of 5431). I also added a debug action so you can see case by case which suit(s) have the same shape as the hand. Did not see any anomalies.
0

#9 User is offline   pescetom 

  • PipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 7,904
  • Joined: 2014-February-18
  • Gender:Male
  • Location:Italy

Posted 2020-November-30, 11:34

View Postsmerriman, on 2020-November-29, 13:40, said:

As mentioned in the other thread, this doesn't validate or disprove the law at all - it's nothing to do with the law.

The law is that the process of imperfect shuffles combined with the groupings of tricks formed by playing out a bridge hand biases the deck.

The most complex part here is coming up with a shuffling algorithm that most resembles real life.

If you had one of those, then perhaps you could shuffle, use robots to play out the hand, shuffle, etc and then after a while (he says 'a few hours', however many deals that would be) see if the tend is towards patterns, which is the whole basis of proving whether the law is true or not.


Discussed on the other thread. This one is just about the script which validates the law as applied to random deals.
0

#10 User is offline   PeterAlan 

  • PipPipPipPipPip
  • Group: Full Members
  • Posts: 616
  • Joined: 2010-May-03
  • Gender:Male

Posted 2020-November-30, 16:14

The following table gives the answers for 5=4=3=1:

Target shape: 5=4=3=1

# deals with 1, 2, 3, 4 or no instances of target:

                                             -- % of -    --- % of ---
 #  # deals                                  all deals    target deals
--  --------------------------------------   ---------    ------------
 1: 18,462,006,540,449,844,182,883,072,000 =  34.41532 %   80.66927 %
 2:  3,997,264,604,908,323,574,425,600,000 =   7.45136 %   17.46595 %
 3:    417,060,951,961,543,212,331,008,000 =   0.77745 %    1.82234 %
 4:      9,713,344,598,876,987,228,160,000 =   0.01811 %    0.04244 %
--  --------------------------------------   ---------    ---------
    22,886,045,441,918,587,956,867,840,000 =  42.66224 %  100.00000 %
--  --------------------------------------   ---------    ---------
 0: 30,758,692,323,570,204,882,369,600,000 =  57.33776 %
==  ======================================   =========
    53,644,737,765,488,792,839,237,440,000 = 100.00000 %
    ======================================   =========


This is an extract from program output that gives these details for all 39 deal shapes, as well as the distributions of longest and shortest suits in the other 3 hands. If anyone is interested in the full output, I'm happy to send it out.

The program calculates these quantities directly from the set of all the possible deal shapes, and does not involve simulation in any form. With that set as the staring point, it's a quick calculation: less than 1/4 second on my first-generation Surface Book.
0

#11 User is offline   PeterAlan 

  • PipPipPipPipPip
  • Group: Full Members
  • Posts: 616
  • Joined: 2010-May-03
  • Gender:Male

Posted 2020-December-07, 14:52

In the unlikely event that anyone is interested, I extended my program to calculate the following statistics concerning the validity of the so-called "Law" of symmetry in the form that a particular hand shape in a deal is likely to lead to the same shape applying to one or more of the suits

(Since there is a complete duality between the hand shape distributions of all possible deals and the corresponding suit distributions, any such "Law" would apply mutatis mutandis to say that a particular suit distribution would imply a corresponding hand distribution somewhere in the deal; did Culbertson make some remark to indicate that he recognised this?)

The table gives, for each hand shape, the probability that a deal containing that hand shape will have one or more suits of the same shape:

Proportion of deals with target hand shape that contain same suit shape:

Target shape    Proportion
============    ==========
     4=3=3=3      59.372 %
     4=4=3=2      76.127 %
     4=4=4=1      30.810 %
     5=3=3=2      65.237 %
     5=4=2=2      56.652 %
     5=4=3=1      63.130 %
     5=4=4=0      29.634 %
     5=5=2=1      31.655 %
     5=5=3=0      23.434 %
     6=3=2=2      50.414 %
     6=3=3=1      35.340 %
     6=4=2=1      42.194 %
     6=4=3=0      32.441 %
     6=5=1=1      12.984 %
     6=5=2=0      17.255 %
     6=6=1=0       3.236 %
     7=2=2=2      18.922 %
     7=3=2=1      56.865 %
     7=3=3=0      12.686 %
     7=4=1=1      15.143 %
     7=4=2=0      16.513 %
     7=5=1=0       5.459 %
     7=6=0=0       0.618 %
     8=2=2=1      42.049 %
     8=3=1=1      26.175 %
     8=3=2=0      24.625 %
     8=4=1=0      10.496 %
     8=5=0=0       0.910 %
     9=2=1=1      48.209 %
     9=2=2=0      22.315 %
     9=3=1=0      27.239 %
     9=4=0=0       2.676 %
    10=1=1=1      24.048 %
    10=2=1=0      66.576 %
    10=3=0=0       9.397 %
    11=1=1=0      68.421 %
    11=2=0=0      31.579 %
    12=1=0=0     100.000 %
    13=0=0=0     100.000 %
============    ==========

1

#12 User is online   blackshoe 

  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 17,693
  • Joined: 2006-April-17
  • Gender:Male
  • Location:Rochester, NY

Posted 2020-December-08, 20:14

I don't see any pattern in those percentages. OTOH, I didn't look very hard. B-)
--------------------
As for tv, screw it. You aren't missing anything. -- Ken Berg
I have come to realise it is futile to expect or hope a regular club game will be run in accordance with the laws. -- Jillybean
0

#13 User is offline   pescetom 

  • PipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 7,904
  • Joined: 2014-February-18
  • Gender:Male
  • Location:Italy

Posted 2020-December-09, 10:39

View PostPeterAlan, on 2020-December-07, 14:52, said:

In the unlikely event that anyone is interested, I extended my program to calculate the following statistics concerning the validity of the so-called "Law" of symmetry in the form that a particular hand shape in a deal is likely to lead to the same shape applying to one or more of the suits.


Thanks very much, of course I am interested.
Also pleased to see that for the key shapes it closely coincides with the outcome of my simulation with less datapoints, for example you have 6511 at 13.0% and I at 14%, you have 7411 at 15.1% and I at 15%.

"With a hand-pattern 7-4-1-1 I am not so happy about my seven-card suit, for it is astonishing how often it will break 7-4-1-1.".

0

#14 User is offline   pescetom 

  • PipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 7,904
  • Joined: 2014-February-18
  • Gender:Male
  • Location:Italy

Posted 2020-December-09, 10:41

View Postblackshoe, on 2020-December-08, 20:14, said:

I don't see any pattern in those percentages. OTOH, I didn't look very hard. B-)


You didn't look very hard at all :blink:
Try looking at what happens when the long suit hits 6 or 7, which is Culbertson's preferred zone for examples.
0

#15 User is offline   PeterAlan 

  • PipPipPipPipPip
  • Group: Full Members
  • Posts: 616
  • Joined: 2010-May-03
  • Gender:Male

Posted 2020-December-09, 11:31

View Postblackshoe, on 2020-December-08, 20:14, said:

I don't see any pattern in those percentages.

Well the effect asserted by Culbertson certainly isn't generally there.

In the extreme cases of deals containing hand patterns 13=0=0=0 or 12=1=0=0 there are perforce the same suit patterns, and some residue of the same effect shows in the relatively high results for the very unusual 11=1=1=0 and 10=2=1=0 shapes. But in the realm of the common hand distributions the numbers largely reflect the preponderance of those shapes in the set of all deal distributions: for example, in the 4=4=3=2 case, 61.185% of all deals contain at least one suit distributed 4=4=3=2; when we're constraining the shapes of the deals in question by limiting them to those with at least one flat 4=4=3=2-shaped hand it's not too surprising that the proportion with a 4=4=3=2 suit rises from 61.185% to 76.127%, but that's as far as it gets in all but the most extreme cases.

I don't suppose that Culbertson ever made any attempt at a proper analysis, either of this mathematical structure or of whatever anecdotal evidence he had of the (hand-shuffled) deals he played. It's natural to notice the cases where patterns occur, and to tune out the cases where they don't, which leads to distorted impressions.

Beware of intuition: results are often counter-intuitive. For example, what do you suppose is the commonest result for the longest suit in a deal? In fact, it's 6 cards (43.3% of all deals), which beats 5 (40.23%), 7 (12.64%), 4 (2.93%) and 8 (1.83%).
0

#16 User is offline   PeterAlan 

  • PipPipPipPipPip
  • Group: Full Members
  • Posts: 616
  • Joined: 2010-May-03
  • Gender:Male

Posted 2020-December-09, 11:43

View Postpescetom, on 2020-December-09, 10:41, said:

Try looking at what happens when the long suit hits 6 or 7, which is Culbertson's preferred zone for examples.

My reply to Blackshoe crossed with your posting this.

I wasn't aware of that detail of Culbertson's suggestion, but it's notable that it's only particular 6- and 7- card shapes that stand out: 7=3=2=1 (especially), 6=3=2=2, and to a lesser extent 6=4=2=1 and 6=3=3=1. Deals containing these shapes are noticeably commoner than those containing other 7- or 6-card shapes.
0

Page 1 of 1


Fast Reply

  

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