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