Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use MATLAB m 8. Assume you are rolling two six-sided dice, each side having an equal chance of occurring. Write a function with header (roll)

use MATLAB image text in transcribed
m 8. Assume you are rolling two six-sided dice, each side having an equal chance of occurring. Write a function with header (roll) = myMonopolyDice (), where roll is the sum of the values of the two dice thrown but with the following extra rule: if the two dice rolls are the same, then another roll is made, and the new sum added to the running total. If the two dice show 3 and 4, then the running total should be 7. If the two dice show I and 1, then the running total should be 2 plus the total of another throw. Rolls stop when the dice rolls are different. Hint: The line result = randi ((1 61,2,1) is an accurate simulation of rolling two dice (See Figure 5.1). Test Cases: >> rolls - zeros (1, 100000); >> for i - 1:100000 rolls (1) - myMonopolyDice(); end >> hist (rolls, 25) >> xlabel('Roll Value) >> ylabel('Number of Occurences') >> title('Histogram of Monopoly Dice Rolls)

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

How To Build A Million Dollar Database

Authors: Michelle Bergquist

1st Edition

0615246842, 978-0615246840

More Books

Students also viewed these Databases questions

Question

=+ how might this lead to faster growth in productivity?

Answered: 1 week ago