示例#1
0
 /**
  * constructor
  *
  * @param b
  * @param color
  */
 public Knight(ChessBoard b, int color) {
   this.color = color;
   if (color == 0) // white knights
   {
     if (b.getPiece(7, 1) == null) {
       b.setPiece(this, 7, 1);
       curx = 7;
       cury = 1;
     } else {
       b.setPiece(this, 7, 6);
       curx = 7;
       cury = 6;
     }
   } else {
     if (b.getPiece(0, 1) == null) {
       b.setPiece(this, 0, 1);
       curx = 0;
       cury = 1;
     } else {
       b.setPiece(this, 0, 6);
       curx = 0;
       cury = 6;
     }
   }
 }