question: public int eval ( INode state ) { EightPuzzleNode node = ( EightPuzzleNode ) state ; int Pn = 0 ; for ( int r = 0 ; r <= EightPuzzleNode . MaxR ; r ++ ) { for ( int c = 0 ; c <= EightPuzzleNode . MaxC ; c ++ ) { if ( node . isEmpty ( r , c ) ) { continue ; } int digit = node . cell ( r , c ) ; Pn += Math . abs ( diffs [ digit ] [ 0 ] - r ) ; Pn += Math . abs ( diffs [ digit ] [ 1 ] - c ) ; } } int gn = 0 ; DepthTransition t = ( DepthTransition ) state . storedData ( ) ; if ( t != null ) { gn = t . depth ; } return gn + Pn ; }
target:  h(n) = P(n), where P(n) is the sum of the distances (via Manhattan metric) that each tile is from "home". <p> Compute f(n) = g(n) + h(n) where g(n) is the length of the path from the  start node n to the state.