Explore the game of roulette

Assignment Help Programming Languages
Reference no: EM13807908

Your assignment is to use a random number generator to explore the game of roulette. A Eurpean roulette wheel has the following numbers:

Single zero wheel: 0-32-15-19-4-21-2-25-17-34-6-27-13-36-11-30-8-23-10-5-24-16-33-1-20-14-31-9-22-18-29-7-28-12-35-3-26

Despite the true mathematics of the matter, "0" is considered neither "odd" nor "even" when someone bets on the ball landing in an odd or even slot. (This is another way in which the house always wins in gambling.)

Many movies and stories have people making outlandish amounts of money by placing a bet on a single number, winning, and then leaving the winnings on that same number and, miraculously, winning again. Let's assume that each of the 37 numbers is equally likely to come up on any spin of the wheel. How unlikely is that any number comes up twice in a row?  And how unlikely is it for the fabled, lucky bettor to win twice in a row by betting the same number? (Be careful... these are two different answers!)

It is relatively straightforward to answer both of these questions using logic and statistics. However, you are to do it using simulations. (Such simulations are called "Monte Carlo simulations." Really!) Use your random number generator as if it were a roulette wheel. Throw a random integer between 0 and 36 inclusive. Each random number generated will represent one spin of the wheel, with the small ball landing in the slot with that number.  Answer the following questions empirically using the results of your simulation:

A. On average, how often does a number come up two times in a row? On average, how often does a number come up three times in a row?

B. If you pick a PARTICULAR number, how long does it take for that number to come up twice in a row? Let's make the number 13, just for fun.

C. What is the longest run of evens in a row in your simulation? What is the longest run of odds in a row?  (Remember that 0 is classified as neither odd nor even.)

You must do at least the following simulations. You may do more, but not less:

1. Do 10,000 spins of the wheel and answer the questions above.

2. Do 1,000,000 spins, and answer the questions above.

3. Do 100,000,000 spins, and answer the questions above.

4. Do 10,000,000,000 spins and answer the questions above. (It may take a long time to run this.)

Be careful to use qword instead of int variables for the appropriate declarations since some of these numbers will be way over 32,767 (the limit of a Pascal int).

Also, while you are debugging your program, it is wise to print out to the screen frequently so you can see what's going on (and perhaps what's going wrong!). But once you start running programs that do LOTS of calculations, then do input and output sparingly; input and output require FAR more time than other calculations, and you want simulations doing millions of trials to go quickly, not slowly.

Reference no: EM13807908

Questions Cloud

The ecological health of the florida everglades : How big of a sample would we need to take if we wanted to find a 00 percent confidence interval with margin of error of only 0.1 degrees celcius.
Consideration of potential acquisition targets : What advice do you have for Raptec's Board of Directors pertaining to their consideration of these potential acquisition targets?
Internal environmental scan-organizational assessment : This section provides the opportunity to develop your course project. Conducting an internal environmental scan or organizational assessment, provides the ability to put the strategy audit together.
What is the order size : Part A: What is the order size? Part B: What is the reorder point if a 90% cycle service level is desired?
Explore the game of roulette : Your assignment is to use a random number generator to explore the game of roulette. Despite the true mathematics of the matter, "0" is considered neither "odd" nor "even" when someone bets on the ball landing in an odd or even slot
What price maximizes revenue : Suppose JJ has only 20 necklaces available to sell next month. What price maximizes revenue, and what is this maximum revenue next month?
Prepare a profit payoff table from transrail point : Prepare a profit payoff table from Transrail's point of view. For this payoff table find Transrail's optimal decision using (1) the pessimistic approach, (2) the optimistic approach, and (3) minimax regret approach.
World health survey of the world health organization. : What are your impressions of the survey items and the level of understanding needed to administer the survey? Pretend you are the surveyor.
Examine the concept of a global company : Write a six pages paper summarizing your findings and drawing from academic sources as well as company information. In your paper, examine the concept of a global company and the question-is a global company a synthesis of its component cultures

Reviews

Write a Review

Programming Languages Questions & Answers

  Program to validate pay rate as it is entered

When pay rate is entered, search array for a match. If there is match, continue rest of the calculations. If there is no match, display error message, a list of valid pay rates, and prompt for another pay rate.

  Write program for real estate agent

Write a program for a real estate agent. The program should perform the following tasks: ask users for the average house price for the each of past 5 years for a single family residence of 1500 square feet.

  Write a program to define constant

Display each of these constants in decimal, in hexadecimal, and as a character usingcout.

  Statement to read variables of type double

Suppose two variables p1 and p2 of type POINT, with two fields, x and y, both of type double, have been declared. Write a statement that reads values for p1 and p2 in that order.

  Program to keep track of a cd or dvd collection

Write a program to keep track of a CD or DVD collection. This can only work exclusively with either CDs or DVDs since some of the data is different.

  Create a console-mode executable class

Create a console-mode executable class (no GUI in this project; let's keep it simple) using the following specifications.

  Design logic for application to allow user to enter item

Design the logic for an application that allows a user to enter an ordered item continuously until a sentinel value is entered. After each item, display its price or the message.

  Program to sort array by employee identification

Let a program which will read employee information into array of objects, sort array by employee identification number, write the sorted array, and calculate different statistics on data.

  Function named quadratic that receives three parameters

Write the definition of a function named quadratic that receives three double parameters a , b , c . If the value of a is 0 then the function prints the message "no solution for a=0" and returns.

  Program to accept each worker-s first and last names

A program which continuouly accepts each worker's first and last names, this year's number of units produced, and last year's number of units produced. Show each employee with a message.

  Develop a functional c program that implements a design

Develop a functional C program that implements a design and create a C program that declares and uses strings.

  Explaining risk in fixed-price contracts

It is recognized that fixed-price contracts offer obvious advantages to buyer organizations because they transfer almost all of the risk to the contractor.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd