@leeappelbaum/

Monte Hall

Java

No description

fork
loading
Files
  • Main.java
  • Contestant.java
  • Game.java
  • Monte.java

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.3996581278895399","path":"Main.java","file":{"path":"Main.java","content":{"asEncoding":{"base64":"Y2xhc3MgTWFpbiB7CiAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgewogICAgaW50IGdhbWVzVG9QbGF5ID0gMTAwOwogICAgaW50IHdpbnMgPSAwOwogICAgYm9vbGVhbiB2ZXJib3NlID0gdHJ1ZTsKCiAgICBHYW1lIGc7CiAgICBmb3IgKGludCBuID0gMTsgbiA8PSBnYW1lc1RvUGxheTsgbisrKQogICAgewogICAgICBpZiAodmVyYm9zZSkKICAgICAgewogICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbiAoIkdhbWUgbnVtYmVyICIgKyBuKTsKICAgICAgfQogICAgICBnID0gbmV3IEdhbWUodmVyYm9zZSk7CiAgICAgIHdpbnMgKz0gZy5nZXRPdXRjb21lKCk7CiAgICAgIGlmICh2ZXJib3NlKQogICAgICB7CiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJOdW1iZXIgb2Ygd2lucyBzbyBmYXIgLi4uICIgKyB3aW5zICsgIlxuIik7CiAgICAgIH0KICAgIH0KICAgIFN5c3RlbS5vdXQucHJpbnRsbiAoIlxuQ29udGVzdGFudCB3b24gIiArIHdpbnMgKyAiIGdhbWVzIG91dCBvZiAiICsgZ2FtZXNUb1BsYXkgKyAiLiIpOwogICAgU3lzdGVtLm91dC5wcmludGxuKCk7CiAgICAvKgogICAgZm9yIChpbnQgaSA9IDA7IGkgPCAxMDAwMDAwOyBpKyspCiAgICB7CiAgICAgIFN5c3RlbS5vdXQucHJpbnQoIiIpOwogICAgfQogICAgKi8KICAgIHRyeSAKICAgIHsKICAgICAgVGhyZWFkLnNsZWVwKDIwMDApOwogICAgfSAKICAgIGNhdGNoIChJbnRlcnJ1cHRlZEV4Y2VwdGlvbiBlKSAKICAgIHsKICAgIH0KICB9Cn0="},"asBuffer":null},"loaded":true}}
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) 
    {
    }
  }
}