Question
You are provided with two dice. One of them is a cube with outcomes from 1 through 6. The other, is a regular octagon (8
You are provided with two dice. One of them is a cube with outcomes from 1 through 6. The other, is a regular octagon (8 sided) with outcomes from 1 through 8. You will write a program that simulates the simultaneous rolling of these dice.
Using While Loop
Create a 8x6 matrix, A and initialize all entries to zero. Call the outcome of the octagon, the row and that of the normal dice, the column. Update the matrix A with the sum of the two outcomes as A(row, column) = row + column.
Repeat the simulation process until all the zeros in A are replaced.
Create a counter to keep track of the frequency of updates as discussed in class.
Plot a well labeled bar chart for the frequency per outcome.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started