solve method
Find the whole path to the target given a state.
If path doesn't exists return null.
Implementation
List<GraphPoint>? solve(S state) {
while (state.status == Status.searching) {
searchStep(state);
}
return switch (state.status) {
Status.success => constructPath(state),
Status.failure => null,
_ => throw Exception("Unreachable branch"),
};
}