Exemplo n.º 1
0
 private static BitBoard makeWithoutFileH() {
   BitBoard result = new BitBoard();
   for (BoardSquare s : BoardSquare.values()) {
     if (s.file() != 'h') {
       result.set(s);
     }
   }
   return result;
 }
Exemplo n.º 2
0
 public static BitBoard makeKnightMoves(BoardSquare kn) {
   BitBoard result = new BitBoard();
   for (BoardSquare bs : BoardSquare.values()) {
     if (kn.hasKnightMoveTo(bs)) {
       result.set(bs);
     }
   }
   return result;
 }
Exemplo n.º 3
0
 private static BitBoard makeInteriorSquares() {
   BitBoard result = new BitBoard();
   for (BoardSquare bs : BoardSquare.values()) {
     if (!bs.onEdge()) {
       result.set(bs);
     }
   }
   return result;
 }
Exemplo n.º 4
0
 public static BitBoard makeBishopMoves(BoardSquare bish) {
   BitBoard result = new BitBoard();
   for (BoardSquare bs : BoardSquare.values()) {
     if (bish.hasBishopMoveTo(bs)) {
       result.set(bs);
     }
   }
   return result;
 }
Exemplo n.º 5
0
 public BitBoard pawnCaptureWest(PieceColor mover) {
   BitBoard result = new BitBoard(this);
   if (mover.equals(PieceColor.WHITE)) {
     result.bits >>>= 9;
   } else {
     result.bits <<= 7;
   }
   return result.intersection(NO_FILE_H);
 }
Exemplo n.º 6
0
 public static BitBoard makeRookMoves(BoardSquare rook) {
   BitBoard result = new BitBoard();
   for (BoardSquare bs : BoardSquare.values()) {
     if (rook.hasRookMoveTo(bs)) {
       result.set(bs);
     }
   }
   return result;
 }
Exemplo n.º 7
0
 public BitBoard pawnAdvance(PieceColor mover) {
   BitBoard result = new BitBoard(this);
   if (mover.equals(PieceColor.WHITE)) {
     result.bits >>>= 8;
   } else {
     result.bits <<= 8;
   }
   return result;
 }
Exemplo n.º 8
0
 public static BitBoard makeQueenMoves(BoardSquare queen) {
   BitBoard result = makeRookMoves(queen);
   return result.union(makeBishopMoves(queen));
 }
Exemplo n.º 9
0
 public BitBoard negation() {
   BitBoard result = new BitBoard();
   result.bits = ~this.bits;
   return result;
 }
Exemplo n.º 10
0
 public BitBoard symmetricDifference(BitBoard that) {
   BitBoard result = new BitBoard(this);
   result.removeIntersection(that);
   return result;
 }
Exemplo n.º 11
0
 public BitBoard union(BitBoard that) {
   BitBoard result = new BitBoard(this);
   result.addAll(that);
   return result;
 }
Exemplo n.º 12
0
 public BitBoard intersection(BitBoard that) {
   BitBoard result = new BitBoard(this);
   result.retainAll(that);
   return result;
 }