MCS-177 optional assignment
One application of computer programs is performing simulations. In
this assignment, your goal will be to simulate investments or wagers.
This assignment differs from other assignments in that I will not
specify what procedures you should write or in what order you should
write them. You'll make all the decisions. This assignment is not
relevant to the current reading in the textbook, though I suggest
you read through Chapter 7 before you begin. You may use any
material from earlier in the course you might find helpful. Feel free
to discuss this assignment freely with classmates to strategize, but
do the programming work and data collecting on your own.
I will not specify how much this assignment will affect your final
grade. It's my hope that you undertake the assignment because it
interests you, and that the affect on your grade is of secondary
importance. Although the assignment is due by the last day of
classes, please try to turn it in earlier.
All or nothing wagers Suppose you have one dollar, and you
are allowed to make a bet. Half the time you win, and you get back
$1.60, but if you lose, you only get back $.60. You can place this
over and over again, but each time you play you have to bet all the
money you have. If you win, you get back 160% of what you started
with. If you lose, you get back only 60% of what you started with.
This might seem like a good bet since you stand to win 60% and lose
Suppose that instead of betting all your money each day on one bet,
you can bet half your money at a time on two separate bets. So, if
you start with $1, you'll bet $.50 twice. There are four
equally likely possibilities:
Once again, you bet all your money each day, but in two separate bets.
This is like diversifying a financial portfolio.
|WIN-WIN||You'll end up with $.80 + $.80 = $1.60
|WIN-LOSE||You'll end up with $.80 + $.30 = $1.10
|LOSE-WIN||You'll end up with $.30 + $.80 = $1.10
|LOSE-LOSE||You'll end up with $.30 + $.30 = $.60
Investigate which wager is better for a typical person to make: The
all-or-nothing or the diversified wager. You should write procedures
to help investigate this question. You should assume that a person
will bet all their money each day for a while. Make any assumptions
you find helpful, including how many days the person bets.
What to turn in
You should write a short report consisting of the data you collected
and the conclusions you drew concerning the two types of bets. Be
sure to present the data clearly enough so I can easily figure out
what it means. Include copies of the procedures you wrote to help
investigate the questions. Naturally, any procedure you write (which
is not self-explanatory) should have a comment clearly explaining what
it takes as arguments and what it returns.
You'll be assessed on the following criteria:
- Results:Did you succeed in assessing which wager is better. How
convincing are your results?
How effective was your use of Scheme procedures to help
investigate the question? Did you do work by hand that could have
been automated by what you know of Scheme?
- Program design:
How well did you break up your task into small, but natural
procedures? Most procedures should be self-contained and have a
clear, easy to describe purpose.
- Programming style: Is each procedure written in a