package vrampal.connectfour.robot;

import vrampal.connectfour.core.Player;

public class ConnectFourRobotStats implements Runnable {

  public static void main(String[] args) {
    new ConnectFourRobotStats().run();
  }

  private static final int NB_TOTAL_GAME = 1000000;

  private int nbRedWin = 0;

  private int nbYellowWin = 0;

  private int nbDraw = 0;

  @Override
  public void run() {
    long beginTime = System.currentTimeMillis();
    for (int i = 0; i < NB_TOTAL_GAME; i++) {
      ConnectFourRobot robotGame = new ConnectFourRobot(false);
      robotGame.run();

      Player winner = robotGame.getGame().getWinner();
      if (winner == null) {
        nbDraw++;
      } else if (winner.getName().equals("Red")) {
        nbRedWin++;
      } else if (winner.getName().equals("Yellow")) {
        nbYellowWin++;
      } else {
        throw new RuntimeException("Unknown winner");
      }
    }
    long endTime = System.currentTimeMillis();

    System.out.println("Nb red win: " + nbRedWin);
    System.out.println("Nb yellow win: " + nbYellowWin);
    System.out.println("Nb draw: " + nbDraw);
    System.out.println("Elapsed time: " + (endTime - beginTime) + " ms");
  }

}

@@ -284,19 +284,22 @@
 e int nb
-Red
+Yellow
 Win = 0;
@@ -308,38 +308,35 @@
   private int nb
-Yellow
+Red
 Win = 0;%0A%0A  priv
@@ -716,19 +716,22 @@
 equals(%22
-Red
+Yellow
 %22)) %7B%0A  
@@ -738,19 +738,22 @@
       nb
-Red
+Yellow
 Win++;%0A 
@@ -785,38 +785,35 @@
 tName().equals(%22
-Yellow
+Red
 %22)) %7B%0A        nb
@@ -804,38 +804,35 @@
 %22)) %7B%0A        nb
-Yellow
+Red
 Win++;%0A      %7D e
@@ -984,11 +984,14 @@
 %22Nb 
-red
+yellow
  win
@@ -998,19 +998,22 @@
 : %22 + nb
-Red
+Yellow
 Win);%0A  
@@ -1029,38 +1029,35 @@
 out.println(%22Nb 
-yellow
+red
  win: %22 + nbYell
@@ -1044,38 +1044,35 @@
  red win: %22 + nb
-Yellow
+Red
 Win);%0A    System

Update display for player order