| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- import java.util.*;
- /**
- * Created by leon on 11/6/17.
- */
-
- public class Simulation{
- private int noDice;
- private int diceRoll;
- Bin bin = new Bin();
- public Simulation(int noDice, int diceRoll){
- this.noDice = noDice;
- this.diceRoll = diceRoll;
-
- }
-
- public static void main(String[]args){
-
- }
-
- public void simMill(){
- Simulation simmy = new Simulation(2,1_000_000);
- Dice dice1 = new Dice();
-
- for (int x = 1_000_000; x >= 0 ; x--){
- Integer sum = dice1.roll(2);
- // System.out.println(sum);
- bin.counter(sum);
-
- }
- //print result
- printer();
-
- }
-
- public void printer(){
- Bin bin1 = new Bin();
- for (int x = 2; x <= 12; x++){
-
- float y = 1_000_000;
- float z = (bin.getValue(x)/y)*(float)100.0 ;
- StringBuilder star = new StringBuilder();
-
- while (z > 0){
- star.append("*");
- z--;
-
- }
- String s = star.toString();
- System.out.printf( "%3d : %7s: %.2f %s\n " , x, bin.getValue(x),
- bin.getValue(x)/y, s);
- }
-
- }
-
- public void simulation()
- {
- Scanner scanner = new Scanner(System.in);
- Scanner close = new Scanner(System.in);
- Dice dice = new Dice();
- boolean result = true;
-
- while(result == true){
- System.out.println("How many dice would you like to roll?");
- int die= scanner.nextInt();
-
- if (die == 1){
- System.out.println("You rolled a " + dice.roll(die) + ".");} else
- if (die > 1){
- System.out.println("The sum of your rolls is: " + dice.roll(die) + ".");
- } else
- if (die == 0){
- System.out.println("All your base are belong to us.");
- } else
- if (die < 0){
- System.out.println("No.");
- }
-
- System.out.println("do you want to exit? Yes or No");
- String exit = close.nextLine();
-
- if (exit.equalsIgnoreCase("No")) {
- continue;
- } else
- if (exit.equalsIgnoreCase("Yes")){
- break;
- } else {
- System.out.println("*Not a valid input*");
- }
-
- }
- printer();
-
- }
-
- }
|