public String getWinner() { if (game.getHighVal() == 3) { return game.getOpp().getXO(); } else { return "Cat Game!"; } }
public int processMove(Object click) { for (int i = 0; i < 9; i++) { if (click == matrix[i]) { game.setMove(i); } } return 0; }
public void restart() { if (printGetMsg(getWinner() + "\nWould you like to restart?", "The End") == 0) { game.setNewGame(true); return; } System.exit(0); }
public void mousePressed(MouseEvent e) { if (game.movesRemain > 0) { processMove(e.getSource()); game.checkNew(); } }
// interfaces for mouselistener and actionlistener public void actionPerformed(ActionEvent e) { if (e.getSource() == reset || e.getSource() == p1 || e.getSource() == p2) { game.resetStats(); } game.newGame(); }