Nifty Assignment: Roulette Simulations

Dave Reed, Creighton University

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 another method for determining the color of a number on the wheel. Note that the implementation of this class utilizes the Die class that was discussed in lectures.

  1. Utilizing the RouletteWheel class, you are to implement a class named RouletteGame that enables the user to play a game of roulette, placing bets either on a particular number or on a color. 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.

  2. Once you are confident that your RouletteGame class behaves as specified, download the RouletteTester class and add it to your project. This class contains a method for performing repeated roulette game simulations, ending each game when the player either doubles her initial bankroll or goes broke. The playRepeatedGames method takes four parameters: the number of games to simulate, the initial bankroll, the amount for each bet, and a string specifying whether bets should be placed on a number or a color. The method simulates the specified number of games and returns the percentage of those games that were wins (i.e., the player doubled her bankroll).

    Use this class to simulate repeated games and answer the following questions. Be sure to explain how you obtained your answers, listing actual simulation results that you obtained.

    1. Assuming you start with 1,000 credits and repeatedly bet on a specific number, what betting strategy maximizes your odds of doubling your bankroll? Should you bet the minimum 10 credits each spin? 50 credits? 100 credits? 500 credits? 1000 credits?
    2. Assuming you start with 1,000 credits and repeatedly bet on a color, what betting strategy maximizes your odds of doubling your bankroll? Should you bet the minimum 10 credits each spin? 50 credits? 100 credits? 500 credits? 1000 credits?
    3. If the answers are different for the last two questions, can you provide an explanation of why this is the case?
    4. Based on your experiments, if you were in a position of having to double your bankroll at a roulette table, what would be the best betting strategy (i.e., which type of bet and how big of a bet)?


  3. 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 playRepeatedGames method so that it simulates the Martingale betting strategy. That is, each game should begin with a bet amount of 1. After a loss, the bet amount should double. After a win, he should go back to the original bet amount. Experiment with your modified method to answer the following questions. Again, be sure to explain how you obtained your answers, listing actual simulation results that you obtained.

    1. Does the Martingale strategy increase or decrease your chances of winning when betting on a specific number? Perform simulations using the same amounts as above and compare the results in order to draw your conclusions.
    2. Does the Martingale strategy increase or decrease your chances of winning when betting on a color? Perform simulations using the same amounts as above and compare the results in order to draw your conclusions.
    3. Based on your experiments, if you were in a position of having to double your bankroll at a roulette table, what would be the best betting strategy (i.e., which type of bet and how big of a bet)?