Example #1
0
 @Override
 public void update(Observable o, Object arg) {
   if (o != pokerMachine) return;
   State state = ((PokerMachine) o).state();
   this.state = state;
   String s = "";
   if (state.pokerHand() == null || state.subState() == state.betMade) s += "XXXXX";
   else s += state.pokerHand().toCharacters() + " " + info(state.pokerHand(), state.handNumber());
   s = s + CommandLineController.lineSeparator;
   if (!(state.pokerHand() == null || state.subState() == state.betMade)) {
     for (int i = 0; i < 5; i++) s += " " + (state.holds[i] ? 'H' : 'T');
     s += CommandLineController.lineSeparator;
   }
   if (state.subState() == state.afterDraw && state.payoff() > 0)
     s += "payoff " + state.payoff() + CommandLineController.lineSeparator;
   s +=
       ("hand "
           + state.hands()
           + ", "
           + state.coins()
           + " Coins, "
           + state.credits()
           + " credits");
   if (/* true|| */ !automatic || state.hands() % 250 == 0) System.out.println(s);
   this.state = state;
 }