Kr Younger 6 yıl önce
ebeveyn
işleme
1eaff706f0
4 değiştirilmiş dosya ile 74 ekleme ve 0 silme
  1. 61
    0
      README.md
  2. 4
    0
      src/main/java/Bins.java
  3. 4
    0
      src/main/java/Dice.java
  4. 5
    0
      src/main/java/Simulation.java

+ 61
- 0
README.md Dosyayı Görüntüle

@@ -0,0 +1,61 @@
1
+# Dicey Lab
2
+
3
+Create a Dice class that acts like a set of N random-tossed dies.
4
+```
5
+Dice dice = new Dice(2); // for craps
6
+Dice dice = new Dice(5); // for yatzee
7
+
8
+Integer toss = dice.tossAndSum();
9
+```
10
+make a couple unit tests for the Dice class. 
11
+
12
+Create a tracking class Bins that can be used to track these results.
13
+
14
+```
15
+Bins results = new Bins(2, 12); // for bins from 2..12
16
+Integer numberOfTens = results.getBin(10); // returns the number of tens in the 10 bin
17
+results.incrementBin(10); // should increment bin # 10
18
+
19
+```
20
+make a couple unit tests for the Bins class.
21
+
22
+Create a Simulation class whose Constructor takes arguments:
23
+    numberOfDies to throw
24
+    numberOfTosses to run
25
+
26
+Create a simulation where two dies are thrown one million times. Keep track of all results.
27
+
28
+```
29
+Simulation sim = new Simulation(2, 10000);
30
+
31
+sim.runSimulation();
32
+
33
+sim.printResults();
34
+```
35
+You can use a main() to run the simulations.
36
+
37
+In your pull requests, create a new file with your name as the filename.
38
+Paul's would be PaulResults.md
39
+
40
+Paste a copy of your text results into that file and then submit your pull request.
41
+
42
+the results of the sim.printResults() should be an output string that looks like this:
43
+
44
+```
45
+***
46
+Simulation of 2 dice tossed for 1000000 times.
47
+***
48
+
49
+ 2 :    27917: 0.03 **
50
+ 3 :    55422: 0.06 *****
51
+ 4 :    83457: 0.08 ********
52
+ 5 :   110961: 0.11 ***********
53
+ 6 :   139098: 0.14 *************
54
+ 7 :   166977: 0.17 ****************
55
+ 8 :   138386: 0.14 *************
56
+ 9 :   111102: 0.11 ***********
57
+10 :    83367: 0.08 ********
58
+11 :    55799: 0.06 *****
59
+12 :    27514: 0.03 **
60
+```
61
+

+ 4
- 0
src/main/java/Bins.java Dosyayı Görüntüle

@@ -0,0 +1,4 @@
1
+
2
+public class Bins {
3
+
4
+}

+ 4
- 0
src/main/java/Dice.java Dosyayı Görüntüle

@@ -0,0 +1,4 @@
1
+public class Dice {
2
+
3
+
4
+}

+ 5
- 0
src/main/java/Simulation.java Dosyayı Görüntüle

@@ -0,0 +1,5 @@
1
+public class Simulation {
2
+
3
+
4
+
5
+}