As
you
can see,
each
number printed
falls between
2
and 12. We are able to put both of our
generators and
the adder on the same
line since
the dice are
always
both thrown at the same
time, and only
the
total
is of interest
here.
Why
would the
following
be
wrong?
50
P.RNDt
1 1 )
+
1
Answer:
Adding
random numbers created by two generators, each picking numbers between
1 and 6
will
create many more sums which equal
3, 4, 5, 6, 7, 8, 9,
10
and
11
than
a
single
generator which
picks an equal
amount
of numbers
1
through 11
(to
which
we add
1,
to
make the range 2
through
12).
Rules of the Game
In its
simplest
form, the game goes like this:
1,
The player rolls the
two
dice. If he rolls a sum of 2 (called "snake eyes"), a 3
(called
"cock-eyes") or a 12
(called
"boxcars")
on
the first roll, he loses and the game is over.
That's "craps".
2,
If the player
rolls
7 or
11 on the first throw, (called "a natural"), he
wins
and
the
game
is
over.
3, If any
other number is rolled, it becomes
the
player's
"point".
He must keep rolling
until he either
"makes his point" by getting the same
number again
to
win,
or
rolls
a
7,
and loses.
EXERCISE
19-1
: You already know far more than enough to
complete this program. Do it.
Put in
all the tests, print lines, etc. to meet the rules of the game
and tell the player what is
going on.
It
will
take
you awhile to finish, but give
it
your
best before you turn over to
Part C (User's
Programs) under
Craps for a
sample solution.
Good
luck!
imp
1*
:->;.
gams
Use
some
of your blank Program Sheets for
writing up this program.
103