Program: 6643
Project: 6643
Buggy source:
public int alphaBeta(Board board,int depth,int ply,int alpha,int beta,boolean nmAllowed){
  if (!useFixedDepth && --pollForStopInterval == 0) {
    pollForStopInterval=TIME_CHECK_INTERVAL;
    if (System.currentTimeMillis() > (timeStarted + timeForThisMove)) {
      System.out.printf("String_Node_Str",System.currentTimeMillis(),timeForThisMove,timeStarted);
      shouldWeStop=true;
    }
  }
  nodesSearched++;
  boolean mcAllowed=false;
  TranspositionTable.HashEntry entry=transTable.get(board.key);
  if (entry != null) {
    transFound++;
    if (entry.depth >= depth) {
      if (entry.type == HASH_EXACT) {
        return entry.eval;
      }
 else       if (entry.type == HASH_ALPHA && entry.eval <= alpha) {
        return entry.eval;
      }
 else       if (entry.type == HASH_BETA && entry.eval >= beta) {
        return entry.eval;
      }
    }
 else {
      if (entry.type == HASH_BETA && entry.eval >= beta) {
        mcAllowed=true;
      }
    }
  }
 else {
    transNotFound++;
  }
  int eval;
  if (depth <= 0) {
    eval=qsearch(board,ply,alpha,beta);
    transTable.putLeaf(board.key,eval,alpha,beta);
    return eval;
  }
  if (board.isDraw())   return Value.DRAW;
  int move;
  boolean isCheck=board.isCheck();
  MoveSelector selector=selectors[ply];
  selector.initialize(board,(entry == null ? Move.MOVE_NONE : entry.move),isCheck,false);
  if ((move=selector.getNextMove()) == Move.MOVE_NONE) {
    return isCheck ? (-Value.MATE + ply) : Value.DRAW;
  }
  if (DO_NULL_MOVES && nmAllowed && depth >= 2 && !isCheck && board.info.material[board.sideToMove] > board.info.pawnMaterial[board.sideToMove]) {
    int epSquare=board.epSquare;
    board.makeNullMove();
    eval=-alphaBeta(board,depth - NM_REDUCTION,ply + 1,-beta,-beta + 1,false);
    board.retractNullMove(epSquare);
    if (eval >= beta) {
      if (!shouldWeStop) {
        transTable.put(board.key,HASH_BETA,depth,eval,move);
      }
      return eval;
    }
  }
  if (shouldWeStop) {
    return 0;
  }
  int bestEval=-Value.INFINITY, bestMove=Move.MOVE_NONE, evalType=HASH_ALPHA;
  int[] moveQueue=new int[MC_EXPAND];
  moveQueue[0]=move;
  int queueIndex=0, queueSize=0;
  before++;
  if (DO_MULTI_CUT && depth >= MC_REDUCTION && mcAllowed) {
    after++;
    int c=0;
    ArrayList<Integer> cuts=new ArrayList<Integer>(MC_CUTOFFS);
    while (true) {
      int piece=Move.getFrom(move);
      if ((MC_PIECE_CHECK && !cuts.contains(piece)) || !MC_PIECE_CHECK) {
        board.make(move);
        eval=-alphaBeta(board,depth - 1 - MC_REDUCTION,ply + 1,-beta,-alpha,true);
        board.retract(move);
        if (eval >= beta) {
          if (MC_PIECE_CHECK)           cuts.add(piece);
          c++;
          if (c == MC_CUTOFFS) {
            mcprunes++;
            return beta;
          }
        }
      }
      queueIndex++;
      if (queueIndex == MC_EXPAND)       break;
      move=selector.getNextMove();
      if (move == Move.MOVE_NONE)       break;
      moveQueue[queueIndex]=move;
    }
    queueSize=queueIndex;
    queueIndex=0;
    move=moveQueue[queueIndex++];
  }
  int movesSearched=0;
  while (true) {
    board.make(move);
    if (evalType == HASH_EXACT) {
      int type=Move.getType(move);
      if (DO_LMR && movesSearched >= LMR_FULL_DEPTH_MOVES && depth >= 3 && !isCheck && !Move.isCapture(type) && !Move.isPromotion(type)) {
        eval=-alphaBeta(board,depth - 2,ply + 1,-alpha - 1,-alpha,true);
      }
 else {
        eval=alpha + 1;
      }
      if (eval > alpha) {
        eval=-alphaBeta(board,depth - 1,ply + 1,-alpha - 1,-alpha,true);
        if (eval > alpha && eval < beta) {
          eval=-alphaBeta(board,depth - 1,ply + 1,-beta,-alpha,true);
        }
      }
    }
 else {
      eval=-alphaBeta(board,depth - 1,ply + 1,-beta,-alpha,true);
    }
    board.retract(move);
    movesSearched++;
    if (eval > bestEval) {
      if (eval >= beta) {
        if (!shouldWeStop) {
          transTable.put(board.key,HASH_BETA,depth,eval,move);
        }
        return beta;
      }
      bestEval=eval;
      bestMove=move;
      if (eval > alpha) {
        evalType=HASH_EXACT;
        alpha=eval;
      }
    }
    if (!shouldWeStop) {
      transTable.put(board.key,evalType,depth,bestEval,bestMove);
    }
    if (queueSize <= queueIndex) {
      move=selector.getNextMove();
      if (move == Move.MOVE_NONE)       break;
    }
 else {
      move=moveQueue[queueIndex++];
    }
  }
  return alpha;
}

Fixed version (ground truth):
public int alphaBeta(Board board,int depth,int ply,int alpha,int beta,boolean nmAllowed){
  if (!useFixedDepth && --pollForStopInterval == 0) {
    pollForStopInterval=TIME_CHECK_INTERVAL;
    if (System.currentTimeMillis() > (timeStarted + timeForThisMove))     shouldWeStop=true;
  }
  nodesSearched++;
  boolean mcAllowed=false;
  TranspositionTable.HashEntry entry=transTable.get(board.key);
  if (entry != null) {
    transFound++;
    if (entry.depth >= depth) {
      if (entry.type == HASH_EXACT) {
        return entry.eval;
      }
 else       if (entry.type == HASH_ALPHA && entry.eval <= alpha) {
        return entry.eval;
      }
 else       if (entry.type == HASH_BETA && entry.eval >= beta) {
        return entry.eval;
      }
    }
 else {
      if (entry.type == HASH_BETA && entry.eval >= beta) {
        mcAllowed=true;
      }
    }
  }
 else {
    transNotFound++;
  }
  int eval;
  if (depth <= 0) {
    eval=qsearch(board,ply,alpha,beta);
    transTable.putLeaf(board.key,eval,alpha,beta);
    return eval;
  }
  if (board.isDraw())   return Value.DRAW;
  int move;
  boolean isCheck=board.isCheck();
  MoveSelector selector=selectors[ply];
  selector.initialize(board,(entry == null ? Move.MOVE_NONE : entry.move),isCheck,false);
  if ((move=selector.getNextMove()) == Move.MOVE_NONE) {
    return isCheck ? (-Value.MATE + ply) : Value.DRAW;
  }
  if (DO_NULL_MOVES && nmAllowed && depth >= 2 && !isCheck && board.info.material[board.sideToMove] > board.info.pawnMaterial[board.sideToMove]) {
    int epSquare=board.epSquare;
    board.makeNullMove();
    eval=-alphaBeta(board,depth - NM_REDUCTION,ply + 1,-beta,-beta + 1,false);
    board.retractNullMove(epSquare);
    if (eval >= beta) {
      if (!shouldWeStop) {
        transTable.put(board.key,HASH_BETA,depth,eval,move);
      }
      return eval;
    }
  }
  if (shouldWeStop) {
    return 0;
  }
  int bestEval=-Value.INFINITY, bestMove=Move.MOVE_NONE, evalType=HASH_ALPHA;
  int[] moveQueue=new int[MC_EXPAND];
  moveQueue[0]=move;
  int queueIndex=0, queueSize=0;
  before++;
  if (DO_MULTI_CUT && depth >= MC_REDUCTION && mcAllowed) {
    after++;
    int c=0;
    ArrayList<Integer> cuts=new ArrayList<Integer>(MC_CUTOFFS);
    while (true) {
      int piece=Move.getFrom(move);
      if ((MC_PIECE_CHECK && !cuts.contains(piece)) || !MC_PIECE_CHECK) {
        board.make(move);
        eval=-alphaBeta(board,depth - 1 - MC_REDUCTION,ply + 1,-beta,-alpha,true);
        board.retract(move);
        if (eval >= beta) {
          if (MC_PIECE_CHECK)           cuts.add(piece);
          c++;
          if (c == MC_CUTOFFS) {
            mcprunes++;
            return beta;
          }
        }
      }
      queueIndex++;
      if (queueIndex == MC_EXPAND)       break;
      move=selector.getNextMove();
      if (move == Move.MOVE_NONE)       break;
      moveQueue[queueIndex]=move;
    }
    queueSize=queueIndex;
    queueIndex=0;
    move=moveQueue[queueIndex++];
  }
  int movesSearched=0;
  while (true) {
    board.make(move);
    if (evalType == HASH_EXACT) {
      int type=Move.getType(move);
      if (DO_LMR && movesSearched >= LMR_FULL_DEPTH_MOVES && depth >= 3 && !isCheck && !Move.isCapture(type) && !Move.isPromotion(type)) {
        eval=-alphaBeta(board,depth - 2,ply + 1,-alpha - 1,-alpha,true);
      }
 else {
        eval=alpha + 1;
      }
      if (eval > alpha) {
        eval=-alphaBeta(board,depth - 1,ply + 1,-alpha - 1,-alpha,true);
        if (eval > alpha && eval < beta) {
          eval=-alphaBeta(board,depth - 1,ply + 1,-beta,-alpha,true);
        }
      }
    }
 else {
      eval=-alphaBeta(board,depth - 1,ply + 1,-beta,-alpha,true);
    }
    board.retract(move);
    movesSearched++;
    if (eval > bestEval) {
      if (eval >= beta) {
        if (!shouldWeStop) {
          transTable.put(board.key,HASH_BETA,depth,eval,move);
        }
        return beta;
      }
      bestEval=eval;
      bestMove=move;
      if (eval > alpha) {
        evalType=HASH_EXACT;
        alpha=eval;
      }
    }
    if (!shouldWeStop) {
      transTable.put(board.key,evalType,depth,bestEval,bestMove);
    }
    if (queueSize <= queueIndex) {
      move=selector.getNextMove();
      if (move == Move.MOVE_NONE)       break;
    }
 else {
      move=moveQueue[queueIndex++];
    }
  }
  return alpha;
}