Package nl.zoidberg.calculon.engine

Examples of nl.zoidberg.calculon.engine.BitBoard


      if(style12.isMyGame()) {
        gameNumber = style12.getGameNumber();
        opponent = style12.getOpponentName();
        playingWhite = (style12.getMyColor() == Piece.WHITE);
        if(style12.isInitialPosition()) {
          currentBoard = new BitBoard().initialise();
        }
      }
     
      if ( ! (style12.getMyRelationToGame() == Style12.REL_ME_TO_MOVE)) {
        return;
      }
     
      if(style12.isFlagged()) {
        gameNumber = -1;
        currentBoard = null;
        return;
      }

      if(style12.getHalfMoveCount() >= 100) {
        log.info("Claiming draw by 50-move rule");
        send("draw");
        return;
      }
     
      if(currentBoard != null && !"none".equals(style12.getPreviousMovePGN())) {
        try {
          currentBoard.makeMove(currentBoard.getMove(PGNUtils.toPgnMoveMap(currentBoard).get(style12.getPreviousMovePGN())));
        } catch (Exception x) {
          log.log(Level.SEVERE, "Apply move failed", x);
        }
      }
     
      if(currentBoard == null || ! currentBoard.equalPosition(style12.getBoard())) {
        log.warning("Out of sync board detected - resetting!");
        currentBoard = style12.getBoard();
      }
     
      if(currentBoard.getRepeatedCount() >= 3) {
        log.info("Claiming draw by 3-fold repitition (opp move)");
        send("draw");
        return;
      }

      String bookMove = openingBook.getBookMove(currentBoard);
      if(bookMove != null) {
        PGNUtils.applyMove(currentBoard, bookMove);
        send(bookMove);
        log.fine("Using book move: " + bookMove);
        return;
      }
     
      if( ! new MoveGenerator(currentBoard).hasNext()) {
        log.fine("Looks like that game is over!");
        return;
      }
     
      Runnable moveMaker = new Runnable() {
        public void run() {
          BitBoard myBoard = currentBoard;
          ChessEngine engine = new ChessEngine();
          if(style12.getGameTime() >= 900) {
            engine.setQuiesce(true);
          }
          String bestMove = engine.getPreferredMove(myBoard);
View Full Code Here


import nl.zoidberg.calculon.engine.PawnMoveGenerator;

public class PerformanceTests {

    public static void main(String[] args) throws Exception {
        BitBoard board = new BitBoard().initialise();

        // Min 1350
        long pre = System.nanoTime();
        for(int x = 0; x < 1000000; x++) {
            MoveGenerator moveGenerator = new MoveGenerator(board);
View Full Code Here

      }
     
      String moves = br.readLine();
      pw.println("\t\t<moves>");
      pw.println("\t\t\t<position>" + position + "</position>");
      BitBoard bb = FENUtils.getBoard(position + " 0 1");
      for(StringTokenizer st = new StringTokenizer(moves); st.hasMoreTokens(); ) {
        String s = st.nextToken();
        String move = s.substring(0, s.indexOf('{')).toUpperCase();
        String count = s.substring(s.indexOf('{') + 1, s.lastIndexOf('}'));
        pw.println("\t\t\t<move pgn=\"" + PGNUtils.translateMove(bb, move) + "\" count=\"" + count + "\"/>");
View Full Code Here

import nl.zoidberg.calculon.notation.PGNUtils;

public class CommandLine {
 
  public static void main(String[] args) throws Exception {
    BitBoard board = new BitBoard().initialise();
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String s;
    while((s = br.readLine()) != null) {
      PGNUtils.applyMove(board, s);
      ChessEngine node = new ChessEngine();
      String move = node.getPreferredMove(board);
      System.out.println(PGNUtils.translateMove(board, move));
      board.makeMove(board.getMove(move));
    }
  }
View Full Code Here

  private BitBoard board;
  private Player whitePlayer, blackPlayer;

  public Game() {
    board = new BitBoard().initialise();
    whitePlayer = new Player();
    blackPlayer = new Player();

//    GameScorer whiteScorer = GameScorer.getDefaultScorer();
View Full Code Here

//  Standard        1270         95    91    13   199   1574 (06-May-2009)
 
  public static void main(String[] args) throws Exception {
    OpeningBook.setUseOpeningBook(false);
   
    BitBoard board = new BitBoard();
    FENUtils.loadPosition("1rbq2r1/3pkpp1/2n1p2p/1N1n4/1p1P3N/3Q2P1/1PP2PBP/R3R1K1 b - - 1 16", board);
    ChessEngine engine = new ChessEngine();
    engine.setDepth(3);

    long pre = System.currentTimeMillis();
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.