Ant590 Posted September 2, 2009 Report Share Posted September 2, 2009 Hi, Can someone who knows how to do these things help me determine the following please: I'm looking for the expectation on the length of club suit when 1♣ is opened under the following conditions: (1) 5+ clubs, 11-20HCP, no other 5-card suit (i.e. standard club openings)and(2) all 11-13 balanced hands (including 5♦332 but not 5M332)and(3) all 4♣441 11-20HCP handsand(4) all 17-19 balanced hands (except 5M332 and 5♦332) Thanks in advanceAnt. Quote Link to comment Share on other sites More sharing options...
helene_t Posted September 2, 2009 Report Share Posted September 2, 2009 100000 simulations gave 17400 hands satisfying the criteria, the percentages for club lengths were2 13.653 26.404 28.845 19.456 9.297 2.098 0.269 0.02The average club length was 3.92 with a standard error of 0.01 Code:hcps = rep(c(rep(0,9),1,2,3,4),4)clubs=c(rep(1,13),rep(0,39))diamonds=c(rep(0,13),rep(1,13),rep(0,26))hearts=c(rep(0,26),rep(1,13),rep(0,13))spades=c(rep(0,39),rep(1,13))mytable = array(dim=c(100000,5))mycards=t(apply(array(1:100000),1,function(x)sample(52,13)))mytable[,1] = apply(mycards,1,function(x)sum(hcps[x]))mytable[,2] = apply(mycards,1,function(x)sum(clubs[x]))mytable[,3] = apply(mycards,1,function(x)sum(diamonds[x]))mytable[,4] = apply(mycards,1,function(x)sum(hearts[x]))mytable[,5] = apply(mycards,1,function(x)sum(spades[x]))balanced = (rowSums(mytable[,2:5]>1)==4) & (rowSums(mytable[,2:3]<6)==2) & (rowSums(mytable[,4:5]<5)==2)noOther5cardsuit = rowSums(mytable[,3:5]>4)==0 antbalhands = balanced & ((((mytable[,1]>10) & (mytable[,1]<14)) | ((mytable[,1]>16) & (mytable[,1]<20))))antunbalhands = !balanced & noOther5cardsuit & (mytable[,2] >3) & (mytable[,1]>10) & (mytable[,1]<21)anthands = antbalhands | antunbalhands sum(anthands) # Number of hands satisfyinground(table(mytable[anthands,2])*100/sum(anthands),2) # tablemean(mytable[anthands,2]) # meansd(mytable[anthands,2])/sqrt(sum(anthands)) # standard error Edit: 5 minutes ago I posted a version where I forgot the HCP constraints un the unbalanced hands. Quote Link to comment Share on other sites More sharing options...
Cascade Posted September 2, 2009 Report Share Posted September 2, 2009 Here is what I got from dealer: Frequency : 2 118621 3 281226 4 287689 5 206532 6 84028 7 19084 8 2617 9 193 10 10 11 0 12 0 13 0 My code was: (hcp(south)>=11 andhcp(south)<=20 andclubs(south)>=5 anddiamonds(south)<5 andhearts(south)<5 andspades(south)<5 andnot shape(south, any 5332)) or (hcp(south)>=11 andhcp(south)<=14 andshape(south, any 4333 + any 4432 + any 5332) andspades(south)<5 andhearts(south)<5) or (hcp(south)>=11 andhcp(south)<=20 andshape(south, any 4441) andclubs(south)==4) or (hcp(south)>=17 andhcp(south)<=19 andshape(south, any 4333 + any 4432 + any 5332) andspades(south)<5 andhearts(south)<5) The run took 9 or 10 sec for 1000000 hands. Here is a second run: Frequency : 2 118175 3 282014 4 287238 5 206442 6 84340 7 19060 8 2538 9 189 10 4 11 0 12 0 13 0 Quote Link to comment Share on other sites More sharing options...
TimG Posted September 2, 2009 Report Share Posted September 2, 2009 (hcp(south)>=11 andhcp(south)<=20 andclubs(south)>=5 anddiamonds(south)<5 andhearts(south)<5 andspades(south)<5 andnot shape(south, any 5332)) or (hcp(south)>=11 andhcp(south)<=14 andshape(south, any 4333 + any 4432 + any 5332) andspades(south)<5 andhearts(south)<5) or (hcp(south)>=11 andhcp(south)<=20 andshape(south, any 4441) andclubs(south)==4) or (hcp(south)>=17 andhcp(south)<=19 andshape(south, any 4333 + any 4432 + any 5332) andspades(south)<5 andhearts(south)<5) The second condition was for 11-13 HCP, not 11-14. As I read the conditions, balanced 5♦332 with 17-19 should not be included in the 1♣ openings. Quote Link to comment Share on other sites More sharing options...
Cascade Posted September 2, 2009 Report Share Posted September 2, 2009 Well spotted these things happen when you do this sort of stuff near midnight. New Code: (hcp(south)>=11 andhcp(south)<=20 andclubs(south)>=5 anddiamonds(south)<5 andhearts(south)<5 andspades(south)<5 andnot shape(south, any 5332)) or (hcp(south)>=11 andhcp(south)<=13 andshape(south, any 4333 + any 4432 + any 5332) andspades(south)<5 andhearts(south)<5) or (hcp(south)>=11 andhcp(south)<=20 andshape(south, any 4441) andclubs(south)==4) or (hcp(south)>=17 andhcp(south)<=19 andshape(south, any 4333 + any 4432 + any 5332) andspades(south)<5 andhearts(south)<5 anddiamonds(south)<5) New Results (for two runs): Frequency : 2 109433 3 261510 4 284520 5 223665 6 95877 7 21775 8 2988 9 225 10 7 11 0 12 0 13 0 Frequency : 2 109699 3 261357 4 284136 5 223636 6 96224 7 21767 8 2962 9 209 10 10 11 0 12 0 13 0 Maybe someone wants to invent a system to match my first conditions. Quote Link to comment Share on other sites More sharing options...
rbforster Posted September 2, 2009 Report Share Posted September 2, 2009 Maybe someone wants to invent a system to match my first conditions. lol ;) Quote Link to comment Share on other sites More sharing options...
Ant590 Posted September 2, 2009 Author Report Share Posted September 2, 2009 Thank you both very much indeed. Out of interest, what program(s) have you used? Is it / are they free? I really feel I should be doing this myself, despite helpful and friendly people such as yourselves coming to my assistance! Quote Link to comment Share on other sites More sharing options...
fred Posted September 2, 2009 Report Share Posted September 2, 2009 The next version of the web-client will be able to answer these questions in a relatively easy way. For example, for your first question, using a graphical interface I can specify 5+ clubs and 0-4 cards in diamonds, hearts, and spades and 11-20 HCP. Then I can ask for the odds of this hand type. The answer I get is 6.38% (which is probably right, but I can't make any promises!). Fred GitelmanBridge Base Inc.www.bridgebase.com Quote Link to comment Share on other sites More sharing options...
helene_t Posted September 2, 2009 Report Share Posted September 2, 2009 I use R. You can download it from http://cran.r-project.org/ As you can probably see at my code, the software has nothing to do with bridge but is a general-purpose statistical software. Quote Link to comment Share on other sites More sharing options...
TimG Posted September 2, 2009 Report Share Posted September 2, 2009 Out of interest, what program(s) have you used? Is it / are they free?I use Dealer. It is free and can be found here. Quote Link to comment Share on other sites More sharing options...
blackshoe Posted September 2, 2009 Report Share Posted September 2, 2009 I'm lazy - and I haven't done any real programming in years. So I tend to look for Mac binaries for things like this. There is one for R, so I downloaded that. Now the question is whether I can learn R well enough to use it. I suppose I could download the Dealer source code, and see if I can get a Mac executable out of that, but for me that would be a lot of work - especially undesirable if somebody else has already done it. Anyone know if anyone has? Quote Link to comment Share on other sites More sharing options...
Cascade Posted September 2, 2009 Report Share Posted September 2, 2009 Out of interest, what program(s) have you used? Is it / are they free?I use Dealer. It is free and can be found here. Me too. Quote Link to comment Share on other sites More sharing options...
Cascade Posted September 2, 2009 Report Share Posted September 2, 2009 The next version of the web-client will be able to answer these questions in a relatively easy way. For example, for your first question, using a graphical interface I can specify 5+ clubs and 0-4 cards in diamonds, hearts, and spades and 11-20 HCP. Then I can ask for the odds of this hand type. The answer I get is 6.38% (which is probably right, but I can't make any promises!). Fred GitelmanBridge Base Inc.www.bridgebase.com It seems to be exactly what I get - 0.063759347 Quote Link to comment Share on other sites More sharing options...
gnasher Posted September 2, 2009 Report Share Posted September 2, 2009 I use Thomas Andrews's "Deal". It's free, and is available for both PC and Mac. Quote Link to comment Share on other sites More sharing options...
Ant590 Posted September 3, 2009 Author Report Share Posted September 3, 2009 Well, I've had a go with deal and dealer and I'm stuck on them both! In dealer, I can run the file, and I generate 40 hands, but if I add something like -p 100 to the end to try and get more or fewer deals I get a bus error. I'm also unsure of how to run an input file. Help! Quote Link to comment Share on other sites More sharing options...
Ant590 Posted September 3, 2009 Author Report Share Posted September 3, 2009 Meanwhile I'm making much more progress with deal. However, it doesn't seem to be able to nestle logical commands. I.e. I can't write a statement like {[spades north]<=4 || {[balanced north]&&[hearts north]==4}} Any ideas what I'm doing wrong? Quote Link to comment Share on other sites More sharing options...
gnasher Posted September 3, 2009 Report Share Posted September 3, 2009 Meanwhile I'm making much more progress with deal. However, it doesn't seem to be able to nestle logical commands. I.e. I can't write a statement like {[spades north]<=4 || {[balanced north]&&[hearts north]==4}} Any ideas what I'm doing wrong? It should be {[spades north]<=4 || ([balanced north]&&[hearts north]==4)} Quote Link to comment Share on other sites More sharing options...
hotShot Posted September 3, 2009 Report Share Posted September 3, 2009 Edit: Andy's suggestion is better!The TCL programming language that deal uses is extremely sensitive to correct blanks and TCL is case sensitive. Expressions are some what unusual.So you better split that condition to: if { [spades north] <= 4 } { if { [balanced north] && [hearts north] == 4 } { Do your thing here! } } 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.