Package nl.zoidberg.calculon.engine

Examples of nl.zoidberg.calculon.engine.BitBoard


  }
 
    @Test
  public void testPosition4() {
    // Tests all castling moves...
    BitBoard board = FENUtils.getBoard("r3k2r/pppq1ppp/2nbbn2/3pp3/3PP3/2NBBN2/PPPQ1PPP/R3K2R w KQkq - 0 8");
    executeBoard(board, new int[] { 41, 1680, 69126, 2833127, });
   
    board = FENUtils.getBoard("r3k2r/ppp2p1p/3bbnpB/n2Np3/q2PP3/2PB1N2/PP1Q1PPP/R3K2R w KQkq - 0 11");
    executeBoard(board, new int[] { 47, 2055, 93774, });
  }
View Full Code Here


    executeBoard(board, new int[] { 47, 2055, 93774, });
  }
 
    @Test
  public void testPosition5() {
    BitBoard board = FENUtils.getBoard("8/PPP4k/8/8/8/8/4Kppp/8 w - - 0 1");
    executeBoard(board, new int[] { 18, 290, 5044, 89363, 1745545, });
  }
View Full Code Here

    executeBoard(board, new int[] { 18, 290, 5044, 89363, 1745545, });
  }
 
    @Test
  public void testPosition6() {
    BitBoard board = FENUtils.getBoard("8/3K4/2p5/p2b2r1/5k2/8/8/1q6 b - - 0 1");
    executeBoard(board, new int[] { 50, 279, 13310, 54703, 2538084});
  }
View Full Code Here

    executeBoard(board, new int[] { 50, 279, 13310, 54703, 2538084});
  }

    @Test
  public void testPosition7() {
    BitBoard board = FENUtils.getBoard("8/p3kp2/6p1/3r1p1p/7P/8/3p2P1/3R1K2 w - - 0 1");
    executeBoard(board, new int[] { 10, 218, 2886, 63771, 927197, });
  }
View Full Code Here

 
  private RookScorer rs = new RookScorer();

    @Test
  public void testScorer() {
    BitBoard board = new BitBoard();
    String fen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
    FENUtils.loadPosition(fen, board);
    assertEquals(0, rs.scorePosition(board));

    fen = "rnbqkbnr/1ppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
View Full Code Here

    assertEquals(2*RookScorer.OPEN_FILE_SCORE, rs.scorePosition(board));
  }
 
    @Test
  public void testConnectedScore() {
    BitBoard board = new BitBoard();
    FENUtils.loadPosition("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/R4RK1 w KQkq - 0 1", board);
    assertEquals(150, rs.scorePosition(board));

    FENUtils.loadPosition("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/4RRK1 w KQkq - 0 1", board);
    assertEquals(150, rs.scorePosition(board));
View Full Code Here

    OpeningBook.setUseOpeningBook(false);
  }
 
    @Test
  public void testTakeHangingPiece() {
    BitBoard board = new BitBoard();
    String fen = "8/1r3k2/8/8/8/8/6K1/RR6 w - - 0 1";
    FENUtils.loadPosition(fen, board);

    ChessEngine node = new ChessEngine();
    String bestMove = node.getPreferredMove(board);
View Full Code Here

    assertEquals("Rxb7+", bestMove);
  }

    @Test
  public void testCheckmate() {
    BitBoard board = new BitBoard();
    String fen = "5k2/R7/8/8/8/8/6K1/1R6 w - - 0 1";
    FENUtils.loadPosition(fen, board);

    ChessEngine node = new ChessEngine();
    String bestMove = node.getPreferredMove(board);
View Full Code Here

    assertEquals(FENUtils.getBoard("7k/7p/8/8/8/8/8/1B5K w - - 0 1").getResult(), Game.RES_NO_RESULT);
    assertEquals(FENUtils.getBoard("7k/7b/8/8/8/8/8/1B5K w - - 0 1").getResult(), Game.RES_DRAW);
    assertEquals(FENUtils.getBoard("7k/7b/8/8/8/8/8/1BN4K w - - 0 1").getResult(), Game.RES_NO_RESULT);
    assertEquals(FENUtils.getBoard("7k/7r/8/8/8/8/8/1B5K w - - 0 1").getResult(), Game.RES_NO_RESULT);

    BitBoard board = FENUtils.getBoard("7k/6bp/8/8/8/8/8/1B5K w - - 0 1");
    assertEquals(board.getResult(), Game.RES_NO_RESULT);
   
    // Only sacrificing the bishop for the pawn draws
    assertEquals("Bxh7", PGNUtils.translateMove(board, new ChessEngine().getPreferredMove(board)));
    PGNUtils.applyMove(board, "Bxh7");
    assertEquals(0, new MoveGenerator(board).getAllRemainingMoves().size());
View Full Code Here

    assertEquals(0, new MoveGenerator(board).getAllRemainingMoves().size());
  }

    @Test
  public void test3RepeatDrawDetect() {
    BitBoard bitBoard = FENUtils.getBoard("8/7k/8/8/8/8/PPP4K/5Q2 w - - 0 1");

    bitBoard.makeMove(BitBoard.generateMove(
        BitBoard.coordToPosition("H2"), BitBoard.coordToPosition("H1"), Piece.WHITE, Piece.KING));
    bitBoard.makeMove(BitBoard.generateMove(
        BitBoard.coordToPosition("H7"), BitBoard.coordToPosition("H8"), Piece.BLACK, Piece.KING));
   
    bitBoard.makeMove(BitBoard.generateMove(
        BitBoard.coordToPosition("H1"), BitBoard.coordToPosition("H2"), Piece.WHITE, Piece.KING));
    bitBoard.makeMove(BitBoard.generateMove(
        BitBoard.coordToPosition("H8"), BitBoard.coordToPosition("H7"), Piece.BLACK, Piece.KING));
    bitBoard.makeMove(BitBoard.generateMove(
        BitBoard.coordToPosition("H2"), BitBoard.coordToPosition("H1"), Piece.WHITE, Piece.KING));
    bitBoard.makeMove(BitBoard.generateMove(
        BitBoard.coordToPosition("H7"), BitBoard.coordToPosition("H8"), Piece.BLACK, Piece.KING));
   
    bitBoard.makeMove(BitBoard.generateMove(
        BitBoard.coordToPosition("H2"), BitBoard.coordToPosition("H1"), Piece.WHITE, Piece.KING));

    // Now, Kh8 draws against K+Q...
    assertEquals("H8H7", new ChessEngine().getPreferredMove(bitBoard));
    bitBoard.makeMove(BitBoard.generateMove(
        BitBoard.coordToPosition("H8"), BitBoard.coordToPosition("H7"), Piece.BLACK, Piece.KING));
    assertEquals(3, bitBoard.getRepeatedCount());
  }
View Full Code Here

TOP

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

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.