Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve Using MATLAB Create a function with the following inputs and outputs: Inputs: SlotRounds, RouletteRounds The inputs are both scalar integers representing the number of

image text in transcribedimage text in transcribedimage text in transcribed

Solve Using MATLAB

Create a function with the following inputs and outputs: Inputs: SlotRounds, RouletteRounds The inputs are both scalar integers representing the number of rounds that the players will be playing each game. Outputs: SlotPlavers, RoulettePlayers, HouseEarnings SlotPlayers and Roulette Plavers will be both matrices with the number of columns equal to the number of players and the number of rows equal to the number of rounds played plus one. The values in the matrix correspond to the amount of money each player has in each round. For example, a 51 x10 matrix represents 10 players playing 50 rounds with the first row representing the players initial money, and each subsequent row is the amount they have after the next round. As rounds progress the players will lose and win money depending on their luck and their total amount of money will be recorded after each round The last output HouseEarning is a vector tracking the total earnings from all players across all games throughout the day from the point of view of the casino. The first row is all zeros since the casino has made no money. Each subsequent row corresponds to the cumulative earnings after each round of both games has been played. The second row should be the total earnings of the casino after the first round of slots and roulette, the third row is the total amount of earnings from both the first and second round of slots and roulette, etc. The last row should be the total amount of money earned or lost by the casino that day. Note that the number of rounds of each game carn differ, and HouseEarnin must track the earnings until both games are done Slots The game of slots is pretty simple to play in real life. You put $100 into the machine from your pocket and pull a handle. The machine has a built in random number generator and you either walk away with S250,000, S100,000, S40,000, S5000, S500 or nothing, simply losing your precious $100. Here, there are 10 slot machines, meaning there are 10 customers. 1 Initialize SlotPlayers as a matrix of zeros with SlotRounds number of rows plus one because the first row is simply the customers initial in-pocket money. Have there be 10 columns. 2 Randomly generate an initial integer value for the in-pocket-money for each customer within the range of S5000 and $25,000. Assign the values to the first row of SlotPlayers. 3. Using your favorite looping mechanism, have your simulation run SlotRounds" number of iterations. 4. For each iteration, generate a Ix10 vector called "Spin" of random decimal numbers between (0-1). 5. Evaluate these spins in a way such that players win money according to the following probabilities. a. Use a nested for loop to loop over each player and compare the spin to the probabilities. b. Add the winnings to that players previous in pocket money to create a new total for that player c. Remember that the player always spends $100 to play regardless of whether they win or lose. d. Also remember that a player is only allowed to bet if they have at least S100. Hint, use an if statement. 6. Update HouseEarnings in each iteration to reflect the cumulative sum of the money won by the casino. Roulette In roulette there are a series of wager options available to each player. Before each round the player decides on their wager type and the amount they want to bet that is above the minimum amount. Then a ceramic ball is thrown on a spinning wheel that has slots numbered from 0-36 (37 slots) and depending on where the ball lands they either win or lose! Bet Types In this simulated version of roulette, we are giving the players the choice of 4 different type of bets: Low, High, Single, Double. Low: This bet signifies that the player is betting that the ball will land among the low numbers, 1-18. If the number rolled is within this range, including1 and 18, they win the amount of the money they bet. So if a player has $1000, bets $100, and wins, they now have S1100. High: This bet is the same as low except for the numbers 19-36 Single: For this bet the player picks a single number between 0-36 and if the ball lands on that number they win 36 times the amount they bet. So if a player has $1000, bets $100, and wins, they now have $4600. Double: For this bet the player picks two numbers between 0-36, if the ball lands on either of these numbers they win 18 times the amount they bet. So if a player has S1000, bets S100, and wins, they now have S2800. 1. Initialize RoulettePlavers with a size of Roulette Rounds plus 1 by 10 matrix of zeros. 2. Assign each customer's initial in-pocket money to the first row of RoulettePlavers as random values between $5,000 and $25,000 3. Initialize a 3x10 matrix of zeros called "BetType" 4. Using your favorite looping mechanism, simulate your game and have it terminate when RouletteRounds is reached. 5. Create a row vector called "Bet" that for every round of the game (iteration of your loop) represents a random amount of money each customer will bet during the game. Have "Bet" be a random amount of 2%-12% of the customers current in-pocket money 6. The minimum bet amount is $100. If The customer does not bet at least S100 then their bet must be changed to S100. If they do not have $100 they do not play for the rest of the rounds since they cannot match the minimum bet and so you can make their bet equal to 0 7. Generate a 3x10 matrix called "BetType" a. These are the four betting options each player has. They can bet a Low, High, Single, or a Double. b. Populate the first row of "BetType" with random integers in the range of-1 to -4. c. These represent which random betting option each player picks. -1 represents a Low bet, -2 represents a High bet, -3 represents a single slot, and -4 represents two slots. d. Loop through the columns in row 1 of "BetType. If there is a -3 then populate that column's second row with a single random integer between 0-36. If the first row is a -4 then populate that column's second and third rows with two different random integers between 0-36 8. Let "Roll" represent which slot the ceramic ball lands on when it's thrown on the game board. Generate a single random integer for each round. 9. Now compare lost their bet by comparing each players information stored in BetType to the number rolled. a. Use a nested for loop to loop over each player and check if they won or lost. b. If they win, add the appropriate amount of money based upon the amount bet and bet type to their previous in pocket total and store this in the next row of RoulettePlavers. c. If the plaver loses subtract their bet amount from their previous in pocket total and store this in the next row of RoulettePlavers. the actual Roll to the be ts every customer has made. Evaluate if they won or 10.Continue this process of betting, rolling, and tracking until RouletteRounds has been reached. 11.Update HouseEanings in each iteration to reflect the cumulative sum of the money won by the casino. YOUR SCRIPT Create a script to compare customer's revenue for several different round cap limits. Look up making a figure with subplots. Here you will compare the trend differences between round cap limits. 1. Run your function four times with 1000, 2000, 3000, and 4000 rounds. These will be displayed in four subplots. 2. Have your first plot be the cumulative sum of all of the SlotPlavers customer's in-pocket money for each round. (Sum SlotPlayers horizontally). Use a 2x2 subplot. 3. Title each subplot with it's number of rounds. And using "sgtitle" title the figure "Customers POV"; 4. Next plot the cumulative sum of all of the RoulettePlavers customer's inpocket money for each round. (Sum RoulettePlavers horizontally) 5. On a final 2x2 subplot, plot the HouseEarnings for each of the four total rounds. Answer these questions with comments in your script. I. What do the sharp spikes(increases, decreases) in the plots represent with respect to the customers? II. If you were a casino manager, would you set a maximum number of rounds a customer can play for slots or roulette? III. In roulette, how does the rate at which the casino makes money change over an increasing number of rounds? Create a function with the following inputs and outputs: Inputs: SlotRounds, RouletteRounds The inputs are both scalar integers representing the number of rounds that the players will be playing each game. Outputs: SlotPlavers, RoulettePlayers, HouseEarnings SlotPlayers and Roulette Plavers will be both matrices with the number of columns equal to the number of players and the number of rows equal to the number of rounds played plus one. The values in the matrix correspond to the amount of money each player has in each round. For example, a 51 x10 matrix represents 10 players playing 50 rounds with the first row representing the players initial money, and each subsequent row is the amount they have after the next round. As rounds progress the players will lose and win money depending on their luck and their total amount of money will be recorded after each round The last output HouseEarning is a vector tracking the total earnings from all players across all games throughout the day from the point of view of the casino. The first row is all zeros since the casino has made no money. Each subsequent row corresponds to the cumulative earnings after each round of both games has been played. The second row should be the total earnings of the casino after the first round of slots and roulette, the third row is the total amount of earnings from both the first and second round of slots and roulette, etc. The last row should be the total amount of money earned or lost by the casino that day. Note that the number of rounds of each game carn differ, and HouseEarnin must track the earnings until both games are done Slots The game of slots is pretty simple to play in real life. You put $100 into the machine from your pocket and pull a handle. The machine has a built in random number generator and you either walk away with S250,000, S100,000, S40,000, S5000, S500 or nothing, simply losing your precious $100. Here, there are 10 slot machines, meaning there are 10 customers. 1 Initialize SlotPlayers as a matrix of zeros with SlotRounds number of rows plus one because the first row is simply the customers initial in-pocket money. Have there be 10 columns. 2 Randomly generate an initial integer value for the in-pocket-money for each customer within the range of S5000 and $25,000. Assign the values to the first row of SlotPlayers. 3. Using your favorite looping mechanism, have your simulation run SlotRounds" number of iterations. 4. For each iteration, generate a Ix10 vector called "Spin" of random decimal numbers between (0-1). 5. Evaluate these spins in a way such that players win money according to the following probabilities. a. Use a nested for loop to loop over each player and compare the spin to the probabilities. b. Add the winnings to that players previous in pocket money to create a new total for that player c. Remember that the player always spends $100 to play regardless of whether they win or lose. d. Also remember that a player is only allowed to bet if they have at least S100. Hint, use an if statement. 6. Update HouseEarnings in each iteration to reflect the cumulative sum of the money won by the casino. Roulette In roulette there are a series of wager options available to each player. Before each round the player decides on their wager type and the amount they want to bet that is above the minimum amount. Then a ceramic ball is thrown on a spinning wheel that has slots numbered from 0-36 (37 slots) and depending on where the ball lands they either win or lose! Bet Types In this simulated version of roulette, we are giving the players the choice of 4 different type of bets: Low, High, Single, Double. Low: This bet signifies that the player is betting that the ball will land among the low numbers, 1-18. If the number rolled is within this range, including1 and 18, they win the amount of the money they bet. So if a player has $1000, bets $100, and wins, they now have S1100. High: This bet is the same as low except for the numbers 19-36 Single: For this bet the player picks a single number between 0-36 and if the ball lands on that number they win 36 times the amount they bet. So if a player has $1000, bets $100, and wins, they now have $4600. Double: For this bet the player picks two numbers between 0-36, if the ball lands on either of these numbers they win 18 times the amount they bet. So if a player has S1000, bets S100, and wins, they now have S2800. 1. Initialize RoulettePlavers with a size of Roulette Rounds plus 1 by 10 matrix of zeros. 2. Assign each customer's initial in-pocket money to the first row of RoulettePlavers as random values between $5,000 and $25,000 3. Initialize a 3x10 matrix of zeros called "BetType" 4. Using your favorite looping mechanism, simulate your game and have it terminate when RouletteRounds is reached. 5. Create a row vector called "Bet" that for every round of the game (iteration of your loop) represents a random amount of money each customer will bet during the game. Have "Bet" be a random amount of 2%-12% of the customers current in-pocket money 6. The minimum bet amount is $100. If The customer does not bet at least S100 then their bet must be changed to S100. If they do not have $100 they do not play for the rest of the rounds since they cannot match the minimum bet and so you can make their bet equal to 0 7. Generate a 3x10 matrix called "BetType" a. These are the four betting options each player has. They can bet a Low, High, Single, or a Double. b. Populate the first row of "BetType" with random integers in the range of-1 to -4. c. These represent which random betting option each player picks. -1 represents a Low bet, -2 represents a High bet, -3 represents a single slot, and -4 represents two slots. d. Loop through the columns in row 1 of "BetType. If there is a -3 then populate that column's second row with a single random integer between 0-36. If the first row is a -4 then populate that column's second and third rows with two different random integers between 0-36 8. Let "Roll" represent which slot the ceramic ball lands on when it's thrown on the game board. Generate a single random integer for each round. 9. Now compare lost their bet by comparing each players information stored in BetType to the number rolled. a. Use a nested for loop to loop over each player and check if they won or lost. b. If they win, add the appropriate amount of money based upon the amount bet and bet type to their previous in pocket total and store this in the next row of RoulettePlavers. c. If the plaver loses subtract their bet amount from their previous in pocket total and store this in the next row of RoulettePlavers. the actual Roll to the be ts every customer has made. Evaluate if they won or 10.Continue this process of betting, rolling, and tracking until RouletteRounds has been reached. 11.Update HouseEanings in each iteration to reflect the cumulative sum of the money won by the casino. YOUR SCRIPT Create a script to compare customer's revenue for several different round cap limits. Look up making a figure with subplots. Here you will compare the trend differences between round cap limits. 1. Run your function four times with 1000, 2000, 3000, and 4000 rounds. These will be displayed in four subplots. 2. Have your first plot be the cumulative sum of all of the SlotPlavers customer's in-pocket money for each round. (Sum SlotPlayers horizontally). Use a 2x2 subplot. 3. Title each subplot with it's number of rounds. And using "sgtitle" title the figure "Customers POV"; 4. Next plot the cumulative sum of all of the RoulettePlavers customer's inpocket money for each round. (Sum RoulettePlavers horizontally) 5. On a final 2x2 subplot, plot the HouseEarnings for each of the four total rounds. Answer these questions with comments in your script. I. What do the sharp spikes(increases, decreases) in the plots represent with respect to the customers? II. If you were a casino manager, would you set a maximum number of rounds a customer can play for slots or roulette? III. In roulette, how does the rate at which the casino makes money change over an increasing number of rounds

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases In Networked Information Systems 6th International Workshop Dnis 2010 Aizu Wakamatsu Japan March 2010 Proceedings Lncs 5999

Authors: Shinji Kikuchi ,Shelly Sachdeva ,Subhash Bhalla

2010th Edition

3642120377, 978-3642120374

Students also viewed these Databases questions

Question

9. Understand the phenomenon of code switching and interlanguage.

Answered: 1 week ago