Homework 7, Random Number Tester.
Short Description:
Write a program that will test the random number generator for various sizes of dice.
Goals
When you finish this homework, you should have:
- Demonstrate your ability to use arrays in assembly
Formal Description
Write an interactive program that will test my random number package for use as a die simulator. Your program should ask the user for a number of sides (s) , between 2 and 100. It should then ask for a number of trials (t), between 10 and 1000. It should then
- Roll a s sided die t times, counting the number of times each side occurred.
- Print a table of results (sides, the number of times that side occurred, the fraction of occurrences/trials)
- Enter an interactive mode that allows the user to provide a side and the program prints the number of times that side occurred.
Your program should print reduced fractions. (this is really just a requirement to get you to implement Euclid's GCD algorithm.)
You will only be given positive integer input, but you should check to see that all values given are in range. Print an error message and repeat the question if the values are not in range.
An example run:
How many sided die do you wish to emulate? (2 - 100) : 4
How many trials do you wish to perform ( 10 - 1000): 4000
Error: 4000 is too many trials.
How many trials do you wish to perform ( 10 - 1000): 100
Conducting 100 trials.
The results are:
Side Outcomes Fraction
1 20 1/5
2 25 1/4
3 27 27/100
4 28 7/25
What side do you wish to see again? (0 - 4, 0 to exit): 3
3 27 27/100
What side do you wish to see again? (0 - 4, 0 to exit): 0
Required Files
A tar or zip file containing all source code to build the program. This
includes a Makefile to assemble your code.
Submission
Submit the assignment to the D2L folder 7 by the due date.