## Rolling Two Dice

Expand Messages
• Three decades ago, I was a break-in crap dealer in a Las Vegas casino. Naturally I was fascinated when a person began playing his system to beat the dice.
Message 1 of 6 , Sep 5, 2004
• 0 Attachment
Three decades ago, I was a break-in crap dealer in a Las Vegas
casino. Naturally I was fascinated when a person began playing
his "system" to beat the dice. Instead of taking my own money
to "get rich quick," I bought a Trash-80, learned to program it, and
proved that any system might win during a set of 100 to 200 rolls,
but over 100,000, even millions of rolls, no one can beat the dice.

As I continued up the corporate ladder, eventually becoming a shift
boss and casino manager, I knew the "house" could occasionally book a
losing shift, even a losing week, but at the end of the year, the
profit would always be there.

When learning a new programming language, one of the first things I
do is write a dice simulation (old habits die hard!). In Liberty
Basic, I can get 36,000 rolls per second (my old pit boss would have
been impressed), but I am not happy with the observed results.

For instance, 7--the decision point in a dice game--is expected to
roll 6 out of 36 times, if it does, the probability = 1.0000. When I
wrote this SimDice program
(http://groups.yahoo.com/group/libertybasic/files/welopez2001/) I
tested it many times. Over 25 runs of 36,000 rolls each, 7 was
rolled an average of .96894 times. This is not good for the house!
After a total of 18,900,000 rolls, the observed frequency of 7
was .96986 percent. Still not very good, it would take some
big "Don't" bettors for the house to stay ahead.

Does anyone find a flaw in my programming? The string concatenation
for the statictext might seem unnecessary, but it's the only way I
know to make it print out on a sheet of paper, otherwise everything
after the first line is dropped by the printer. Being old fashioned,
I like hard copies. LOL!

By the way, if you want to try beating me when rolling two dice, try
the MyLuckyDice program. The probabilities are as accurate as I can
make them using Libby, and the scorekeeping is accurate. To see how
fast you can win (or lose!), just hold down the ENTER key after your
first roll.

Good luck!
• bill@jbmailroom, This may be off-topic, and anyone from this yahoogroup could and probably should write back privately: Do the casino people (not the
Message 2 of 6 , Sep 5, 2004
• 0 Attachment
bill@jbmailroom,

This may be off-topic, and anyone from this yahoogroup could and probably
should write back privately:

Do the casino people (not the customers, but the dealers, managers, and other
administrators and such) formally study much mathematics in order to have
good technical knowledge of their business? Do they use mathematics to analyze
what occurs from day to day in the casinos? Do the casinos use
mathematicians? Do they use computer programmers?

G C

In a message dated 09/05/2004 11:46:32 AM Pacific Daylight Time,
bill@... writes:
> Three decades ago, I was a break-in crap dealer in a Las Vegas
> casino. Naturally I was fascinated when a person began playing
> his "system" to beat the dice. Instead of taking my own money
> to "get rich quick," I bought a Trash-80, learned to program it, and
> proved that any system might win during a set of 100 to 200 rolls,
> but over 100,000, even millions of rolls, no one can beat the dice.
>
> As I continued up the corporate ladder, eventually becoming a shift
> boss and casino manager,

[Non-text portions of this message have been removed]
• Could it be that you are not generating a true random number with Liberty Basic? Just using the randomize syntax will not give a true random number each time
Message 3 of 6 , Sep 5, 2004
• 0 Attachment
Could it be that you are not generating a true random number with Liberty
Basic? Just using the randomize syntax will not give a true random number
each time you seed the generator.

Ron Spruell

-------Original Message-------

From: libertybasic@yahoogroups.com
Date: 09/05/04 13:46:28
To: libertybasic@yahoogroups.com
Subject: [libertybasic] Rolling Two Dice

Three decades ago, I was a break-in crap dealer in a Las Vegas
casino. Naturally I was fascinated when a person began playing
his "system" to beat the dice. Instead of taking my own money
to "get rich quick," I bought a Trash-80, learned to program it, and
proved that any system might win during a set of 100 to 200 rolls,
but over 100,000, even millions of rolls, no one can beat the dice.

As I continued up the corporate ladder, eventually becoming a shift
boss and casino manager, I knew the "house" could occasionally book a
losing shift, even a losing week, but at the end of the year, the
profit would always be there.

When learning a new programming language, one of the first things I
do is write a dice simulation (old habits die hard!). In Liberty
Basic, I can get 36,000 rolls per second (my old pit boss would have
been impressed), but I am not happy with the observed results.

For instance, 7--the decision point in a dice game--is expected to
roll 6 out of 36 times, if it does, the probability = 1.0000. When I
wrote this SimDice program
(http://groups.yahoo.com/group/libertybasic/files/welopez2001/) I
tested it many times. Over 25 runs of 36,000 rolls each, 7 was
rolled an average of .96894 times. This is not good for the house!
After a total of 18,900,000 rolls, the observed frequency of 7
was .96986 percent. Still not very good, it would take some
big "Don't" bettors for the house to stay ahead.

Does anyone find a flaw in my programming? The string concatenation
for the statictext might seem unnecessary, but it's the only way I
know to make it print out on a sheet of paper, otherwise everything
after the first line is dropped by the printer. Being old fashioned,
I like hard copies. LOL!

By the way, if you want to try beating me when rolling two dice, try
the MyLuckyDice program. The probabilities are as accurate as I can
make them using Libby, and the scorekeeping is accurate. To see how
fast you can win (or lose!), just hold down the ENTER key after your
first roll.

Good luck!

To visit your group on the web, go to:
http://groups.yahoo.com/group/libertybasic/

To unsubscribe from this group, send an email to:
libertybasic-unsubscribe@yahoogroups.com

[Non-text portions of this message have been removed]
• I did my best to assure the program generated truly random numbers-- if there really is such a thing-- by inserting randomize(Time\$( seconds )) just before
Message 4 of 6 , Sep 5, 2004
• 0 Attachment
I did my best to assure the program generated 'truly' random numbers-- if there really is such a thing-- by inserting randomize(Time\$("seconds")) just before and outside the do until/loop. Putting randomize outside the loop once should be sufficient, although it could be placed inside the loop, but that would probably slow loop execution. "Seconds" gets the number of seconds since midnight from the computer clock and produces a different seed number each time the program is executed. Still, the results were far from expectations, with the highest .99183 (not too disappointing0 and the lowest .93916 (very disappointing but, hey, real dice do "get out of line" once in awhile. The aggregate probability over 18,900,000 rolls was .96909. Close, but not encouraging.

Welopez
www.jbmailroom.com
http://welopez.mystarband.net/

[Non-text portions of this message have been removed]
• ... From: William Lopez ... there really is such a thing-- by inserting randomize(Time\$( seconds )) just before and outside the do
Message 5 of 6 , Sep 5, 2004
• 0 Attachment
----- Original Message -----
From: "William Lopez" <bill@...>

>
> I did my best to assure the program generated 'truly' random numbers-- if
there really is such a thing-- by inserting randomize(Time\$("seconds")) just
before and outside the do until/loop. Putting randomize outside the loop
once should be sufficient, although it could be placed inside the loop, but
that would probably slow loop execution. "Seconds" gets the number of
seconds since midnight from the computer clock and produces a different seed
number each time the program is executed. Still, the results were far from
expectations, with the highest .99183 (not too disappointing0 and the lowest
.93916 (very disappointing but, hey, real dice do "get out of line" once in
awhile. The aggregate probability over 18,900,000 rolls was .96909. Close,
but not encouraging.
>
> Welopez

William;
Have you considered filling an array with the probable results of say
500 rolls of the dice. Then using
int(rnd(1)*500)+1 to randomly choose one of those 500 results? This might
come closer to the expected
outcome.

Ken
• Nope, hadn t thought of that, Ken, but it s worth a shot. If I can squeeze in some time tomorrow, I ll give it a try. Thanks for the suggestion. Welopez
Message 6 of 6 , Sep 5, 2004
• 0 Attachment
Nope, hadn't thought of that, Ken, but it's worth a shot. If I can squeeze in some time tomorrow, I'll give it a try.

Thanks for the suggestion.

Welopez
www.jbmailroom.com
http://welopez.mystarband.net/

[Non-text portions of this message have been removed]
Your message has been successfully submitted and would be delivered to recipients shortly.