Jogo de Cassino Craps

Tentei rodar o jogo craps 1milhão de vezes, pra calcular quantas vezes casa e jogador ganham o jogo. Acontece que no final a soma de jogos vencidos + perdidos dá menos de 1milhão e não estou entendendo o porquê.

import java.security.SecureRandom;

public class CrapsFreq
{
   // create secure random number generator for use in method rollDice
   private static final SecureRandom randomNumbers = new SecureRandom();

   // enum type with constants that represent the game status
   private enum Status {CONTINUE, WON, LOST};

   // constants that represent common rolls of the dice
   private static final int SNAKE_EYES = 2;
   private static final int TREY = 3;
   private static final int SEVEN = 7;
   private static final int YO_LEVEN = 11;
   private static final int BOX_CARS = 12;

   // plays one game of craps
   public static void main(String[] args)
   {
      int myPoint = 0; // point if no win or loss on first roll
      int playerWins = 0, playerLoses = 0;
      int i = -1;
      Status gameStatus; // can contain CONTINUE, WON or LOST
      int[] nthRollWon = new int[50]; //If the player WON, in which roll he/she did it?
      int[] nthRollLost = new int[50];
      int stillPlaying = 0; // How many rolls have been passed until the player WIN or LOSES?
      
      while(i++ < 1000000) {
    	  
    	  int sumOfDice = rollDice(); // first roll of the dice
    	  // determine game status and point based on first roll 
	      switch (sumOfDice) 
	      {
	         case SEVEN: // win with 7 on first roll
	         case YO_LEVEN: // win with 11 on first roll           
	            gameStatus = Status.WON;
	            ++nthRollWon[0];
	            break;
	         case SNAKE_EYES: // lose with 2 on first roll
	         case TREY: // lose with 3 on first roll
	         case BOX_CARS: // lose with 12 on first roll
	            gameStatus = Status.LOST;
	            ++nthRollLost[0];
	            break;
	         default: // did not win or lose, so remember point         
	            gameStatus = Status.CONTINUE; // game is not over
	            myPoint = sumOfDice; // remember the point
	            //System.out.printf("Point is %d%n", myPoint);
	            break;
	      } 
      
     
      // while game is not complete
	      while (gameStatus == Status.CONTINUE) // not WON or LOST
	      { 
	    	 stillPlaying++;
	         sumOfDice = rollDice(); // roll dice again
	
	         // determine game status
	         if (sumOfDice == myPoint) // win by making point
	            gameStatus = Status.WON;
	         else 
	            if (sumOfDice == SEVEN) // lose by rolling 7 before point
	               gameStatus = Status.LOST;
	      } 
	
	      // Use variable stillPlaying as an index
	      if (gameStatus == Status.WON && stillPlaying != 0) {
	         ++playerWins;
	         ++nthRollWon[stillPlaying];
	      }
	      else if(gameStatus == Status.LOST && stillPlaying != 0) {
	         ++playerLoses;
	         ++nthRollLost[stillPlaying];
	      }
	      stillPlaying = 0;
      }
      
      System.out.println(playerWins);
      System.out.println(playerLoses);
      for(int num : nthRollWon) System.out.printf("%d ", num);
      System.out.println();
      for(int num : nthRollLost) System.out.printf("%d ", num);
   }
   
   // roll dice, calculate sum and display results
   public static int rollDice()
   {
      // pick random die values
      int die1 = 1 + randomNumbers.nextInt(6); // first die roll
      int die2 = 1 + randomNumbers.nextInt(6); // second die roll
      int sum = die1 + die2; // sum of die values
      return sum; 
   }
} // end class Craps

Explicando o Craps: Lançam-se sempre 2 dados de 6 faces e somam-se seus valores
Se o jogador tirar 7 ou 11 na 1ªrodada: GANHA o jogo
Se o jogador tirar 2,3 ou 12 na 1ªrodada: PERDE o jogo
Se não tirar nenhum dos valores acima na 1ªrodada, o jogador ficará com seu Número da Sorte valendo o mesmo que o valor obtido nessa 1ªrodada. Ex: Jogador tirou 6, entao seu Número da Sorte será 6.
O objetivo passa a ser tirar o valor do Número da Sorte novamente numa rodada posterior, MAS caso caia o 7 nas próximas rodadas, ele perderá o jogo.
Exemplo de possiveis jogos, na ordem temporal: 6 -> 4 -> 5 -> 9 -> 6 … O jogador VENCEU!!
Exemplo b) 6 -> 8 -> 11 -> 5 -> 7… O jogador PERDEU!!

if (gameStatus == Status.WON && stillPlaying != 0) {

e

else if(gameStatus == Status.LOST && stillPlaying != 0) {

stillPlaying pode ser zero e não atualizar as variáveis playerWins e playerLoses.

1 curtida