Package nl.zoidberg.calculon.engine

Examples of nl.zoidberg.calculon.engine.BitBoard


    assertEquals(0, new MoveGenerator(bitBoard).getAllRemainingMoves().size());
  }
 
    @Test
  public void enPassant() {
    BitBoard bitBoard = new BitBoard().initialise();
    PGNUtils.applyMoves(bitBoard, new String[] { "Nh3", "d5", "Ng1", "d4", "e4", });
   
    assertEquals("rnbqkbnr/ppp1pppp/8/8/3pP3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 3", FENUtils.generate(bitBoard));
   
    PGNUtils.applyMove(bitBoard, "dxe3");
View Full Code Here


    assertEquals("rnbqkbnr/ppp1pppp/8/8/8/4p3/PPPP1PPP/RNBQKBNR w KQkq - 0 4", FENUtils.generate(bitBoard));
  }

    @Test
  public void castling() {
    BitBoard bitBoard = FENUtils.getBoard("4k3/8/8/8/8/8/8/4K2R w KQkq - 0 1");
    PGNUtils.applyMove(bitBoard, "O-O");
    assertEquals("4k3/8/8/8/8/8/8/5RK1 b kq - 1 1", FENUtils.generate(bitBoard));
   
    bitBoard = FENUtils.getBoard("4k3/8/8/8/8/8/8/R3K2R w KQkq - 0 1");
    PGNUtils.applyMove(bitBoard, "O-O-O");
View Full Code Here

    assertEquals("2kr3r/8/8/8/8/8/8/4K3 w KQ - 1 2", FENUtils.generate(bitBoard));
  }
 
    @Test
  public void knightCheck() {
    BitBoard bitBoard = FENUtils.getBoard("7k/8/8/8/8/8/5n2/7K w - - 0 4");
    assertEquals(true, CheckDetector.isPlayerToMoveInCheck(bitBoard));

    bitBoard = FENUtils.getBoard("7k/8/n7/8/8/6n1/8/7K w - - 0 4");
    assertEquals(true, CheckDetector.isPlayerToMoveInCheck(bitBoard));
View Full Code Here

    assertEquals(false, CheckDetector.isPlayerToMoveInCheck(bitBoard));
  }
 
    @Test
  public void rookCheck() {
    BitBoard bitBoard = FENUtils.getBoard("7k/8/8/8/8/8/8/r6K w - - 0 4");
    assertEquals(true, CheckDetector.isPlayerToMoveInCheck(bitBoard));
  }
View Full Code Here

    assertEquals(true, CheckDetector.isPlayerToMoveInCheck(bitBoard));
  }

    @Test
  public void bishopCheck() {
    BitBoard board = FENUtils.getBoard("b6k/8/8/8/8/8/8/7K w - - 0 4");
    assertEquals(true, CheckDetector.isPlayerToMoveInCheck(board));

    board = FENUtils.getBoard("B6k/8/8/8/8/8/8/7K w - - 0 4");
    assertEquals(false, CheckDetector.isPlayerToMoveInCheck(board));
  }
View Full Code Here

    assertEquals(false, CheckDetector.isPlayerToMoveInCheck(board));
  }
 
    @Test
  public void knightMoves() {
    BitBoard board = FENUtils.getBoard("7k/8/8/8/8/8/7P/7K w - - 0 1");
    int baseMoves = new MoveGenerator(board).getAllRemainingMoves().size();
   
    board = FENUtils.getBoard("7k/8/8/8/3N4/8/7P/7K w - - 0 1");
    assertEquals(baseMoves + 8, new MoveGenerator(board).getAllRemainingMoves().size());
View Full Code Here

    assertEquals(baseMoves + 2, new MoveGenerator(board).getAllRemainingMoves().size());
  }
 
    @Test
  public void pawnCaptures() {
    BitBoard board = FENUtils.getBoard("7k/7p/8/bp1n2P1/1PP1P3/8/8/7K w - - 0 1");
    List<BitBoardMove> rv = new ArrayList<BitBoardMove>();
    new PawnCaptureGenerator().generateMoves(board, false, -1L, rv);
    assertEquals(4, rv.size());

    String fen = "7k/7p/8/bp1n2P1/1PP1P3/8/8/7K b - - 0 1";
    board = FENUtils.getBoard(fen);
   
    PGNUtils.applyMove(board, "h5");
    assertTrue(board.isEnPassant());
    assertEquals(7, board.getEnPassantFile());
    assertEquals(5, board.getEnPassantRank());
   
    rv.clear();
    new PawnCaptureGenerator().generateMoves(board, false, -1L, rv);
    assertEquals(5, rv.size());
   
    board = board.reverse();
    rv.clear();
    new PawnCaptureGenerator().generateMoves(board, false, -1L, rv);
    assertEquals(5, rv.size());
    assertTrue(board.isEnPassant());
    assertEquals(7, board.getEnPassantFile());
    assertEquals(2, board.getEnPassantRank());
  }
View Full Code Here

*/
public class PerftTest {

    @Test
  public void testPosition1() {
    BitBoard board = new BitBoard().initialise();
    executeBoard(board, new int[] { 20, 400, 8902, 197281, 4865609, });
  }
View Full Code Here

    executeBoard(board, new int[] { 20, 400, 8902, 197281, 4865609, });
  }
 
    @Test
  public void testPosition2() {
    BitBoard board = FENUtils.getBoard("r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1");
    executeBoard(board, new int[] { 48, 2039, 97862, 4085603, });
//    executeBoard(board, new int[] { 48, 2039, 97862, 4085603, 193690690, });
  }
View Full Code Here

  }

    @Test
  public void testPosition3() {
    // Some very complex enpassant moves in this one.
    BitBoard board = FENUtils.getBoard("8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - - 0 1");

    executeBoard(board, new int[] { 14, 191, 2812, 43238, 674624, 11030083, });
//    executeBoard(board, new int[] { 14, 191, 2812, 43238, 674624, 11030083, 178633661, });
  }
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.