This homework assignment is also available in PDF.
Assigned: Tuesday, 3 October 2006
Due: Friday, 6 October 2006
Summary: In this assignment, you will further explore
the use of the
random procedure to simulate a game of
To reinforce the exploration of the
from the lab on randomness and simulation. To remind you that
the house always wins.
Expected Time: One to two hours.
Collaboration: You may work in a group of any size between one and four, inclusive. You may consult others outside your group, provided you cite those others. You need only submit one assignment per group.
Submitting: Email me your work, using a subject of CSC151 Homework 9.
Warning: So that this exercise is a learning assignment for everyone, I may spend class time publicly critiquing your work.
One of the many table gains available in most casinos is Craps. While Craps has a variety of betting rules, the basic rules for rolling the dice are fairly simple. Here's what Wikipedia has to say on the subject.
Craps features a plethora of bets, but the most fundamental is thepass linewager, which nearly all players make. On a come-out roll, the pass line bettors win when either a 7 or 11 is rolled. A 2, 3, or 12 loses, and is calledcraps. When any other number (4, 5, 6, 8, 9, or 10) is rolled, it is called the point. Once a point has been set, the pass-line bettor wins if the point is rolled again, and loses if a 7 is rolled first (seven-out).
For our purposes in this assignment, we'll assume one die is red (or scarlet) and one die is black.
In this assignment, you will simulate the game of Craps, focusing only on the results for pass-line bettors.
a. Write a procedure,
(craps-narrative), that plays and
narrates one sequence from a game of Craps. Your narrative should
roll new dice each time, and therefore have unpredictable results.
> (craps-narrative) Come-out roll. The red die shows 1. The black die shows 6. A seven: You win! > (craps-narrative) Come-out roll. The red die shows 2. The black die shows 3. The point is 5. The red die shows 5. The black die shows 5. The point is 5. The red die shows 3. The black die shows 4. Seven out. > (craps-narrative) Come-out roll. The red die shows 1. The black die shows 5. The point is 6. The red die shows 3. The black die shows 5. The point is 6. The red die shows 4. The black die shows 2. You made the point. > (craps-narrative) Come-out roll. The red die shows 1. The black die shows 5. The point is 6. The red die shows 3. The black die shows 5. The point is 6. The red die shows 4. The black die shows 2. You made the point. > (craps-narrative) Come-out roll. The red die shows 4. The black die shows 1. The point is 5. The red die shows 2. The black die shows 5. Seven out.
b. To the Statistician, the interesting thing about Craps is not what happens in one game, or even a few, but what happens, on average, over a sequence of games.
Write a procedure,
pass-line-bet-wins? that simulates
one sequence from a game of Craps and returns true (
if the pass-line bettor wins and false otherwise.
Using this procedure, simulate one thousand sequences of Craps and determine how often the pass-line bettor wins in that sequence.
For both parts of the assignment, you will likely find it useful to write a main procedure that does the initial roll and a helper procedure that gets passed the points goal from the first roll.
We wrote the following two helper procedures in our own solution to this assignment. You may also find them helpful.
(define roll-a-die (lambda () (+ 1 (random 6)))) (define display-dice (lambda (red black) (display " The red die shows ") (display red) (display ". The black die shows ") (display black) (display ".") (newline)))
Wikipedia (2006). Craps. Online article at
28 September 2006, visited 1 October 2006).
Sunday, 1 October 2006 [Samuel A. Rebelsky]
Monday, 2 October 2006 [Samuel A. Rebelsky]
I usually create these pages
on the fly, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Thu Nov 30 21:42:52 2006.
The source to the document was last modified on Tue Oct 24 08:26:33 2006.
This document may be found at
You may wish to validate this document's HTML ; ;Samuel A. Rebelsky, firstname.lastname@example.org
http://creativecommons.org/licenses/by-nc/2.5/or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.