|
@@ -1,6 +1,6 @@
|
1
|
1
|
# Kris-Tof Dice Toss
|
2
|
2
|
|
3
|
|
-Create a Dice class that acts like a set of N random-tossed dies.
|
|
3
|
+Create a `Dice` class that acts like a set of N random-tossed dies.
|
4
|
4
|
```
|
5
|
5
|
Dice dice = new Dice(2); // for craps
|
6
|
6
|
Dice dice = new Dice(5); // for yatzee
|
|
@@ -9,7 +9,7 @@ Integer toss = dice.tossAndSum();
|
9
|
9
|
```
|
10
|
10
|
make a couple unit tests for the Dice class.
|
11
|
11
|
|
12
|
|
-Create a tracking class Bins that can be used to track these results.
|
|
12
|
+Create a tracking class `Bins` that can be used to track the results of dice tosses.
|
13
|
13
|
|
14
|
14
|
```
|
15
|
15
|
Bins results = new Bins(2, 12); // for bins from 2..12
|
|
@@ -17,13 +17,22 @@ Integer numberOfTens = results.getBin(10); // returns the number of tens in the
|
17
|
17
|
results.incrementBin(10); // should increment bin # 10
|
18
|
18
|
|
19
|
19
|
```
|
20
|
|
-make a couple unit tests for the Bins class.
|
|
20
|
+make a couple unit tests for the Bins class. Your test methods should follow this template:
|
21
|
21
|
|
22
|
|
-Create a Simulation class whose Constructor takes arguments:
|
|
22
|
+ in the tests
|
|
23
|
+ Create a new Bin
|
|
24
|
+ increment a bin some number of times in a for loop, say `max = 100;` times,
|
|
25
|
+ then get the Bin value,
|
|
26
|
+ compare the Bin value to `max`, they should be equal.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+Create a `Simulation` class whose Constructor takes arguments:
|
23
|
31
|
numberOfDies to throw
|
24
|
32
|
numberOfTosses to run
|
25
|
33
|
|
26
|
|
-Create a simulation where two dies are thrown one million times. Keep track of all results.
|
|
34
|
+Create a simulation where two dies are thrown *one million times*.
|
|
35
|
+Keep track of each roll by incrementing the correct Bin.
|
27
|
36
|
|
28
|
37
|
```
|
29
|
38
|
Simulation sim = new Simulation(2, 10000);
|
|
@@ -32,9 +41,10 @@ sim.runSimulation();
|
32
|
41
|
|
33
|
42
|
sim.printResults();
|
34
|
43
|
```
|
|
44
|
+
|
35
|
45
|
You can use a main() to run the simulations.
|
36
|
46
|
|
37
|
|
-In your pull requests, create a new file with your name as the filename.
|
|
47
|
+In your pull requests, create a new file with your unique name as the filename.
|
38
|
48
|
Paul's would be PaulResults.md
|
39
|
49
|
|
40
|
50
|
Paste a copy of your text results into that file and then submit your pull request.
|
|
@@ -59,3 +69,4 @@ Simulation of 2 dice tossed for 1000000 times.
|
59
|
69
|
12 : 27514: 0.03 **
|
60
|
70
|
```
|
61
|
71
|
|
|
72
|
+Since this is using random when running, your numbers for each Bin may vary.
|