Package nl.zoidberg.calculon.engine.BitBoard

Examples of nl.zoidberg.calculon.engine.BitBoard.BitBoardMove


            return new MoveGenerator(bitBoard).getAllRemainingMoves().size();
    }

        int count = 0;
    for(Iterator<BitBoardMove> moveItr = new MoveGenerator(bitBoard); moveItr.hasNext(); ) {
      BitBoardMove move = moveItr.next();
      byte x = bitBoard.getFlags();
      long cs = bitBoard.getChecksum();
      bitBoard.makeMove(move);
      count += generateToDepth(depth-1, bitBoard);
      bitBoard.unmakeMove();
View Full Code Here


   * @param simpleAlgebraic
   * @return
   */
  public static String translateMove(BitBoard bitBoard, String simpleAlgebraic) {
    if (simpleAlgebraic.startsWith("O-")) {
      BitBoardMove bbMove = bitBoard.getMove(simpleAlgebraic);
      bitBoard.makeMove(bbMove);
      String rv = simpleAlgebraic + getCheckNotation(bitBoard);
      bitBoard.unmakeMove();
      return rv;
    }
View Full Code Here

      if((moveTo & bitBoard.getBitmapColor(player)) != 0) {
        return;
      }
     
      isCapture = (moveTo & bitBoard.getBitmapOppColor(player)) != 0;
      BitBoardMove bbMove;
      if(isCapture) {
        // This is a capturing move.
        bbMove = BitBoard.generateCapture(
            source, moveTo, player, getPieceType(), bitBoard.getPiece(moveTo));
      } else {
View Full Code Here

      if((moveTo & bitBoard.getBitmapColor(player)) != 0) {
        return;
      }
     
      isCapture = (moveTo & bitBoard.getBitmapOppColor(player)) != 0;
      BitBoardMove bbMove;
      if(isCapture) {
        // This is a capturing move.
        bbMove = BitBoard.generateCapture(
            source, moveTo, player, getPieceType(), bitBoard.getPiece(moveTo));
      } else {
View Full Code Here

  }
 
  private void tryCaptures(BitBoard bitBoard, byte player, long nextPiece,
      long captured, long epLocation, boolean alreadyInCheck, boolean safeFromCheck, List<BitBoardMove> rv) {
   
    BitBoardMove bbMove;
    if(captured == epLocation) {
      bbMove = BitBoard.generateEnPassantCapture(nextPiece, captured, player);
    } else {
      bbMove = BitBoard.generateCapture(
          nextPiece, captured, player, Piece.PAWN, bitBoard.getPiece(captured));
View Full Code Here

                        rv.add(BitBoard.generateDoubleAdvanceMove(
                                nextPawn, shiftStrategy.shiftForward(nextPawn, 2), playerIdx));
                    }
                }
            } else {
                BitBoardMove bbMove = BitBoard.generateMove(nextPawn, toSquare, playerIdx, Piece.PAWN);
                bitBoard.makeMove(bbMove);
                if (!CheckDetector.isPlayerJustMovedInCheck(bitBoard, !alreadyInCheck)) {
                    if ((toSquare & BitBoard.FINAL_RANKS) != 0) {
                        rv.addAll(BitBoard.generatePromotions(nextPawn, toSquare, playerIdx));
                    } else {
                        rv.add(bbMove);
                    }
                }
                bitBoard.unmakeMove();

                if(doubleMove) {
                    BitBoardMove pushTwo = BitBoard.generateDoubleAdvanceMove(
                            nextPawn, shiftStrategy.shiftForward(nextPawn, 2), playerIdx);
                    bitBoard.makeMove(pushTwo);
                    if(!CheckDetector.isPlayerJustMovedInCheck(bitBoard, !alreadyInCheck)) {
                        rv.add(pushTwo);
                    }
View Full Code Here

        long kingMoves = KING_MOVES[Long.numberOfTrailingZeros(kingPos)];
        kingMoves &= bitBoard.getBitmapOppColor(player);
        while(kingMoves != 0) {
          long nextMove = Long.lowestOneBit(kingMoves);
          kingMoves ^= nextMove;
          BitBoardMove bbMove = BitBoard.generateCapture(
              kingPos, nextMove, player, Piece.KING, bitBoard.getPiece(nextMove));
          bitBoard.makeMove(bbMove);
            if( ! CheckDetector.isPlayerJustMovedInCheck(bitBoard)) {
                rv.add(bbMove);
            }
View Full Code Here

    long emptyMoves = KING_MOVES[Long.numberOfTrailingZeros(king)]&(~bitBoard.getAllPieces());

    while(emptyMoves != 0) {
      long nextMove = Long.lowestOneBit(emptyMoves);
      emptyMoves ^= nextMove;
      BitBoardMove bbMove = BitBoard.generateMove(king, nextMove, player, Piece.KING);
      bitBoard.makeMove(bbMove);
            if( ! CheckDetector.isPlayerJustMovedInCheck(bitBoard)) {
                rv.add(bbMove);
            }
      bitBoard.unmakeMove();
View Full Code Here

    }
  }

  // Bit twiddling routines...
  private boolean isCastlingPossible(BitBoard bitBoard, byte player, short castleDir) {
    BitBoardMove bbMove = BitBoard.generateCastling(castleDir);
    bitBoard.makeMove(bbMove);
        boolean rv = ! CheckDetector.isPlayerJustMovedInCheck(bitBoard);
    bitBoard.unmakeMove();
    return rv;
  }
View Full Code Here

    bitBoard.unmakeMove();
    return rv;
  }

  private boolean isIntermediateCheck(BitBoard bitBoard, long fromSquare, long toSquare, byte player) {
    BitBoardMove bbMove = BitBoard.generateMove(fromSquare, toSquare, player, Piece.KING);
    bitBoard.makeMove(bbMove);
        boolean rv = CheckDetector.isPlayerJustMovedInCheck(bitBoard);
    bitBoard.unmakeMove();
    return rv;
  }
View Full Code Here

TOP

Related Classes of nl.zoidberg.calculon.engine.BitBoard.BitBoardMove

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.