Parse states and set initial and goal state.