hw/hw4/hw4/puzzle/Board.java
public int manhattan() {
        int count = 0;
        for (int i = 0; i < N * N - 1; i++) {
            int[] currPos = conv2D(board.indexOf(i + 1));
            int[] goalPos = conv2D(i);
            count += compDist(currPos, goalPos);
        }
        return count;
    }
/**
     *  Manhattan estimate.
     *
     *  The sum of the Manhattan distances (sum of the vertical and
     *  horizontal distance) from the tiles to their goal positions.
     */
Manhattan estimate.
The sum of the Manhattan distances (sum of the vertical and
horizontal distance) from the tiles to their goal positions.
Manhattan estimate . The sum of the Manhattan distances ( sum of the vertical and horizontal distance ) from the tiles to their goal positions .
public int manhattan() {
        int count = 0;
        for (int i = 0; i < N * N - 1; i++) {
            int[] currPos = conv2D(board.indexOf(i + 1));
            int[] goalPos = conv2D(i);
            count += compDist(currPos, goalPos);
        }
        return count;
    }
public int manhattan ( ) { int count = 0 ; for ( int i = 0 ; i < N * N - 1 ; i ++ ) { int [ ] currPos = conv2D ( board . indexOf ( i + 1 ) ) ; int [ ] goalPos = conv2D ( i ) ; count += compDist ( currPos , goalPos ) ; } return count ; }
Manhattan estimate.
Manhattan estimate .