... PuzzleState current = problem.getCurrentState(); PuzzleState newState = move.doMove(current); if ( newState == null ) { display("That move is not possible. Try again.\n"); } else { problem.setCurrentState(newState); display(newState.toString()); } ...
Draw a sequence diagram that describes the code segment. Assume that console, problem, current, and move exist when the sequence begins. Also assume that the created newState is not null.