示例#1
0
  public Session(Casino casino, Strategy strategy) {
    this.casino = casino;
    this.strategy = strategy;
    this.shoe = new Shoe(casino.getNumberOfDecks(), strategy);

    totalProfit = 0.0;
    totalWage = 0.0;
    averageProfit = 0.0;
    gameWonPercentage = 0.0;
    numberOfWonGame = 0;
    cumProfit = new double[casino.getNumberOfGames()];
    games = new Game[casino.getNumberOfGames()];
  }
示例#2
0
 private void solve() {
   for (int i = 0; i < casino.getNumberOfGames(); i++) {
     totalProfit += games[i].getProfit();
     totalWage += games[i].getActualAmountWagered();
     cumProfit[i] = totalProfit;
     numberOfWonGame += ((games[i].getProfit() > 0) ? 1 : 0);
   }
   Simulator.finished(this);
 }
示例#3
0
  public void playGames() {
    int shoeMax = shoe.size(); // full shoe size
    double standardBet = 10;

    for (int i = 0; i < casino.getNumberOfGames(); i++) {
      double betMultiplier = strategy.getBetMultiplier(shoe.getHotness());
      double bet = standardBet * betMultiplier;

      // System.out.println("Bet = " + bet);

      games[i] = new Game(strategy, casino, shoe, bet);
      games[i].play();

      // shuffle deck when less than 25% remaining
      if ((double) shoe.size() / (double) shoeMax <= .25) {
        shoe.shuffle();
      }
    }
    solve();
  }
示例#4
0
 public double getGameWonPercentage() {
   return numberOfWonGame * 100.0 / casino.getNumberOfGames();
 }