Buggy code:
public class Board { protected byte [ ] [ ] board ; protected int boardSize ; public Board ( int boardSize ) { } public Board ( byte [ ] [ ] board , int boardSize ) { } public void setCell ( GameMove move ) { } public void resetCell ( GameMove move ) { } public int getCell ( Point point ) { } public int getBoardSize ( ) { } public int getBoardSpaces ( ) { } public byte [ ] [ ] getBoard ( ) { } public boolean isLegal ( GameMove move ) { } public void updateBoard ( GameMove move , ScoreBoard sb ) { } public boolean onBoard ( Point p ) { } public boolean isOccupied ( Point p ) { } public boolean onEdge ( Point p ) { } public boolean isFull ( ) { } private void checkCaptures ( GameMove move , ScoreBoard sb ) { } private void pathfind ( Point startPath , GameMove move , ScoreBoard sb ) { byte [ ] [ ] explored = new byte [ boardSize ] [ boardSize ] ; byte [ ] [ ] scoreMap = sb . getBoard ( ) ; int i ; int j ; HashMap < Integer , ArrayList < PointPair > > potentialMoves = new HashMap < Integer , ArrayList < PointPair > > ( ( ( sb . getMaxScore ( ) ) + 1 ) ) ; <START_BUG> for ( int a = 0 ; a < ( sb . getMaxScore ( ) ) ; a ++ ) { <END_BUG> potentialMoves . put ( a , new ArrayList < PointPair > ( ) ) ; } ArrayList < Point > exploredList = new ArrayList < Point > ( ) ; if ( ! ( onBoard ( startPath ) ) ) { return ; } if ( onEdge ( startPath ) ) { return ; } exploredList . add ( startPath ) ; explored [ startPath . y ] [ startPath . x ] = 1 ; Point currCell = startPath ; for ( i = - 1 ; i <= 1 ; i ++ ) { for ( j = - 1 ; j <= 1 ; j ++ ) { if ( ( i != 0 ) && ( j != 0 ) ) { int newRow = ( ( int ) ( currCell . getY ( ) ) ) + i ; int newCol = ( ( int ) ( currCell . getX ( ) ) ) + j ; Point nextCell = new Point ( newCol , newRow ) ; if ( onBoard ( nextCell ) ) { int cellScore = sb . getValue ( nextCell ) ; PointPair newPointPair = new PointPair ( nextCell , currCell ) ; potentialMoves . get ( cellScore ) . add ( newPointPair ) ; explored [ nextCell . y ] [ nextCell . x ] = 1 ; } } } } boolean exhausted = false ; while ( ! exhausted ) { outerloop : for ( i = sb . getMaxScore ( ) ; i >= 0 ; i -- ) { if ( ! ( potentialMoves . get ( i ) . isEmpty ( ) ) ) { for ( j = 0 ; j < ( potentialMoves . get ( i ) . size ( ) ) ; j ++ ) { PointPair nextTry = potentialMoves . get ( i ) . get ( 0 ) ; Point newCell = nextTry . getNewCell ( ) ; Point prevCell = nextTry . getPrevCell ( ) ; if ( ( board [ newCell . y ] [ newCell . x ] ) == ( move . getPlayer ( ) ) ) { potentialMoves . get ( i ) . remove ( 0 ) ; break outerloop ; } if ( ( ( Math . abs ( ( ( newCell . x ) - ( prevCell . x ) ) ) ) + ( Math . abs ( ( ( newCell . y ) - ( prevCell . y ) ) ) ) ) == 2 ) { int ownerCellX ; int ownerCellY ; ownerCellX = board [ ( ( prevCell . y ) + ( ( newCell . y ) - ( prevCell . y ) ) ) ] [ prevCell . x ] ; ownerCellY = board [ prevCell . y ] [ ( ( prevCell . x ) + ( ( newCell . x ) - ( prevCell . x ) ) ) ] ; if ( ( ownerCellX == ( move . getPlayer ( ) ) ) && ( ownerCellY == ( move . getPlayer ( ) ) ) ) { continue ; } } if ( ( scoreMap [ newCell . y ] [ newCell . x ] ) == ( sb . getMaxScore ( ) ) ) { return ; } currCell = newCell ; for ( i = - 1 ; i <= 1 ; i ++ ) { for ( j = - 1 ; j <= 1 ; j ++ ) { if ( ( i != 0 ) && ( j != 0 ) ) { int newRow = ( ( int ) ( currCell . getY ( ) ) ) + i ; int newCol = ( ( int ) ( currCell . getX ( ) ) ) + j ; newCell = new Point ( newCol , newRow ) ; if ( ( onBoard ( newCell ) ) && ( ( explored [ newRow ] [ newCol ] ) == 0 ) ) { int cellScore = scoreMap [ newRow ] [ newCol ] ; PointPair newPointPair = new PointPair ( newCell , currCell ) ; potentialMoves . get ( cellScore ) . add ( newPointPair ) ; exploredList . add ( newCell ) ; explored [ newCell . y ] [ newCell . x ] = 1 ; } } } }

Fix:
for ( int a = 0 ; a <= ( sb . getMaxScore ( ) ) ; a ++ ) {