public EightPuzzleState getChildStateForOperator ( Operator op ) { // Create a copy of the existing board state EightPuzzleState newState ; try { newState = ( EightPuzzleState ) clone ( ) ; } catch ( CloneNotSupportedException e ) { throw new IllegalStateException ( "Puzzle state could not be cloned." , e ) ; } // Update the new board state using the in-place operator application newState . updateWithOperator ( op ) ; return newState ; }
Applies a move to generate a new board position . This creates a new state object and updates its board position . The board position in this object is not changed .