Esempio 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;
 }
Esempio 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;
 }
Esempio n. 3
0
 private static BitBoard makeInteriorSquares() {
   BitBoard result = new BitBoard();
   for (BoardSquare bs : BoardSquare.values()) {
     if (!bs.onEdge()) {
       result.set(bs);
     }
   }
   return result;
 }
Esempio 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;
 }
Esempio 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);
 }
Esempio 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;
 }
Esempio 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;
 }
Esempio n. 8
0
 public static BitBoard makeQueenMoves(BoardSquare queen) {
   BitBoard result = makeRookMoves(queen);
   return result.union(makeBishopMoves(queen));
 }
Esempio n. 9
0
 public BitBoard negation() {
   BitBoard result = new BitBoard();
   result.bits = ~this.bits;
   return result;
 }
Esempio n. 10
0
 public BitBoard symmetricDifference(BitBoard that) {
   BitBoard result = new BitBoard(this);
   result.removeIntersection(that);
   return result;
 }
Esempio n. 11
0
 public BitBoard union(BitBoard that) {
   BitBoard result = new BitBoard(this);
   result.addAll(that);
   return result;
 }
Esempio n. 12
0
 public BitBoard intersection(BitBoard that) {
   BitBoard result = new BitBoard(this);
   result.retainAll(that);
   return result;
 }