Example #1
0
 /** Set player PLAYER ("white" or "black") to be an automated player. */
 private void autoCommand(String player) {
   try {
     Piece s = Piece.playerValueOf(player);
     _playing = false;
     _players[s.ordinal()] = new MachinePlayer(s, this);
   } catch (IllegalArgumentException excp) {
     error("unknown player: %s", player);
   }
 }
Example #2
0
 /**
  * Set a position on the board to be the Piece.
  *
  * @param pos the position to set the piece to
  * @param player the name of the piece to set
  */
 private void setCommand(String pos, String player) {
   try {
     int c = _board.col(pos);
     int r = _board.row(pos);
     Piece s = Piece.setValueOf(player);
     _board.set(c, r, s, s.opposite());
   } catch (IllegalArgumentException excp) {
     error("Invalid set command.");
   }
 }