Ejemplo n.º 1
0
 public String getWinner() {
   if (game.getHighVal() == 3) {
     return game.getOpp().getXO();
   } else {
     return "Cat Game!";
   }
 }
Ejemplo n.º 2
0
 public int processMove(Object click) {
   for (int i = 0; i < 9; i++) {
     if (click == matrix[i]) {
       game.setMove(i);
     }
   }
   return 0;
 }
Ejemplo n.º 3
0
  public void restart() {

    if (printGetMsg(getWinner() + "\nWould you like to restart?", "The End") == 0) {
      game.setNewGame(true);
      return;
    }
    System.exit(0);
  }
Ejemplo n.º 4
0
 public void mousePressed(MouseEvent e) {
   if (game.movesRemain > 0) {
     processMove(e.getSource());
     game.checkNew();
   }
 }
Ejemplo n.º 5
0
 // interfaces for mouselistener and actionlistener
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == reset || e.getSource() == p1 || e.getSource() == p2) {
     game.resetStats();
   }
   game.newGame();
 }