Source of HumanPlayer.java


  1: 
  2: package tictactoe;
  3: 
  4: public class HumanPlayer extends Player {
  5: 
  6:   public HumanPlayer(Game game, int id) {
  7:     super(game, id); 
  8:     move = new Move(); 
  9:   }
 10: 
 11:   synchronized public Move makeMove() {
 12:     //System.out.println("HumanPlayer " + id + " makeMove");
 13: 
 14:     try {
 15:       wait(); 
 16:     } catch (InterruptedException e) {
 17:     }         
 18:     return move; 
 19:   }
 20: 
 21:   synchronized public void selectCell(int x, int y) {
 22:     move.row = x;
 23:     move.column = y; 
 24:     notifyAll(); 
 25:   }
 26: 
 27:   protected Move move; 
 28: 
 29: }