Computer Science Fundamentals (CS153 2003S)
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[EC]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Lab Writeups]
[Outlines]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Misc:
[Experiments in Java]
[Scheme Reference]
[Scheme Report]
[CS153 2002S (Walker)]
[CS151 2003S (Rebelsky)]
[CS152 2000F (Rebelsky)]
[SamR]
Summary:
In this laboratory, you will explore that random
procedure using some fun
Web services.
a. Make a copy of
dicegame.ss
in your public_html
directory.
b. Make the corresponding CGI script.
#!/bin/bash /home/rebelsky/bin/schemeweb dicegame.ss
c. Share the CGI script and make it executable.
% share dicegame.ss % share dicegame.cgi % chmod a+x dicegame.cgi
d. Start DrScheme and load dicegame.ss
.
e. Read through the procedures and make sure you understand what they do.
Verify that the dicegame.cgi
script works.
Linda and Larry Leter have become addicted to the idea of putting
lets around lambdas. Hence, they'd like to change the definition
of pair-a-dice
to
(define pair-a-dice (let ((dice (list (roll-a-die) (roll-a-die)))) (lambda () dice)))
a. What do you think about their idea?
b. Test their change from within DrScheme by repeatedly rolling a pair
of dice (using pair-a-dice
). Do you notice anything
interesting about the results?
c. Test their change on the Web. Do you notice the same change? Why or why not?
Update dicegame.ss
so that it reports the result of
10 rolls (or perhaps a user-selectable number of rolls) each time,
rather than a single roll.
a. Update play-even-odd
so that the house wins $2 rather
than $1 if the dice are odd.
b. Can you foresee any problems that might occur with this change? If so, which ones?
c. Experiment ot see if your claim is correct.
Update dicegame.ss
so that the player wins if the
two dice total 7 or 11 rather than an odd number.
Update dicegame.ss
so that the player wins if the
two dice total 7 or 11 or if both dice have the same value.
Update dicegame.ss
so that the player can choose
the amount to bet.
Update dicegame.ss
so that the game is based on flipping
coins, rather than rolling dice. (You can choose an appropriate game.)
Thursday, 19 September 2002 [Samuel A. Rebelsky]
Friday, 20 September 2002 [Samuel A. Rebelsky]
Monday, 4 November 2002 [Samuel A. Rebelsky]
game-page
.
Monday, 3 March 2003 [Samuel A. Rebelsky]
dicegame.ss
.
http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2003S/Labs/random-web.html
.
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[EC]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Lab Writeups]
[Outlines]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Misc:
[Experiments in Java]
[Scheme Reference]
[Scheme Report]
[CS153 2002S (Walker)]
[CS151 2003S (Rebelsky)]
[CS152 2000F (Rebelsky)]
[SamR]
Disclaimer:
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 Tue May 6 09:19:59 2003.
The source to the document was last modified on Mon Mar 3 22:48:39 2003.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS153/2003S/Labs/random-web.html
.
You may wish to
validate this document's HTML
;
;
Check with Bobby