@leeappelbaum/

Monte Hall

Java

No description

fork
loading
Files
  • Main.java
  • Contestant.java
  • Game.java
  • Monte.java
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class Main {
  public static void main(String[] args) {
    int gamesToPlay = 100;
    int wins = 0;
    boolean verbose = true;

    Game g;
    for (int n = 1; n <= gamesToPlay; n++)
    {
      if (verbose)
      {
        System.out.println ("Game number " + n);
      }
      g = new Game(verbose);
      wins += g.getOutcome();
      if (verbose)
      {
        System.out.println("Number of wins so far ... " + wins + "\n");
      }
    }
    System.out.println ("\nContestant won " + wins + " games out of " + gamesToPlay + ".");
    System.out.println();
    /*
    for (int i = 0; i < 1000000; i++)
    {
      System.out.print("");
    }
    */
    try 
    {
      Thread.sleep(2000);
    } 
    catch (InterruptedException e) 
    {
    }
  }
}