Spring 2012

For this assignment, you will utilize an existing class and implement a new class for simulating a game of roulette. Using these classes and a third provided class, you will perform repeated simulations of your roulette game and study the effectiveness of various betting strategies. In doing so, you will experience the power of software models in studying the behavior of real-world systems.

The RouletteWheel class models an American-style roulette wheel, with slots numbered 1 through 36 and two additional slots, numbered 0 and 00. This class has a method for generating a random spin and additional methods for determining the color and parity of a number on the wheel.

- Utilizing the
`RouletteWheel`

class, you are to implement a class named`RouletteGame`

that enables the user to play a game of roulette. The user can specify three types of bets, either odd/even, red/black, or a specific number (1-36). A RouletteGame javadoc file is provided for you to define the methods of this class and their precise behavior. Implement this class so that it meets the specifications in the javadoc file. Be sure to test your implementation carefully.

- Once you are confident that your
`RouletteGame`

class behaves as specified, download the RouletteTester class and add it to your BlueJ project. This class contains a method for simulating a round of bets and returning the net winnings, as well as one for simulating repeated rounds and displaying statistics.Construct a

`RouletteTester`

object that starts each round with 100 credits and bets 1 credit per bet. Using this object, answer the following questions.- Simulate 100,000 rounds, each consisting of 100 bets on "red", and report your statistics. Similarly, report the statistics on the same numbers of rounds but betting on "even" and the number (1-36) of your choice.
- Based on your statistics, does betting on parity (odd/even) increase your odds of winning a round when compared to betting on color (red/black)? Does it affect your expected losses? Justify your answers.
- Similarly, does betting on a specific number increase your odds of winning a round when compared to betting on color (red/black)? Does it affect your expected losses? Justify your answers.
- Does increasing the number of bets per round (say doubling it to 200 bets per round) affect the statistics for any of the three betting strategies? Should it? Provide statistics to justify your answer.
- Does increasing the bet amount (say increasing the bet from 1 to 10) affect the statistics for any of the three betting strategies? Should it? Provide statistics to justify your answer.

- The Martingale betting strategy is centuries old, but still pops up in viral emails and in various
scams. The strategy calls for the gambler to double the bet amount after each loss, so that the first
win would recover all previous losses plus win a profit equal to the original bet.
The claim is that this system will guarantee
a profit. In reality, it does nothing of the kind, since its success relies upon the
gambler having an infinite bankroll (and the house not imposing betting limits).
Modify the

`playRound`

method so that it simulates the Martingale betting strategy. That is, each round should begin using the initial bet amount. After a loss, the bet amount should double. After a win, it should go back to the original bet amount. Experiment with your modified method to answer the following questions.- Repeat the simulations on the three different types of bets (100,000 rounds of 100 bets), now using your Martingale betting strategy. Report your statistics.
- Based on your statistics, does the Martingale strategy increase your chances of winning a round when betting on a color (red/black)? Does it affect your expected losses? Justify your answers.
- Similarly, does the Martingale strategy increase your chances of winning when betting on a specific number? Does it affect your expected losses? Justify your answers.
- Does increasing the number of bets per round have more or less effect than it did for the uniform betting strategy? Provide statistics to justify your answer.
- Does increasing the bet amount have more or less effect than it did for the uniform betting strategy? Provide statistics to justify your answer.

`RouletteGame.java`

and modified `RouletteTester.java`

files via the Digital Dropbox, along with your answers to the questions.