use is_solution_state flag in find_solution
[scpubgit/DX.git] / lib / DX / SearchProcess.pm
index 10248ab..cb50a2f 100644 (file)
@@ -13,14 +13,7 @@ has current_search_state => (
 sub new_for {
   my ($class, $hyp, $props) = @_;
   $class->new(
-    current_search_state => DX::SearchState->new(
-      current_hypothesis => $hyp,
-      alternatives => [],
-      next_step => DX::Step::InvokeNextPredicate->new(
-        proposition => $props->members->[0],
-      ),
-      propositions => $props,
-    ),
+    current_search_state => DX::SearchState->new_for($hyp, $props),
   );
 }
 
@@ -34,7 +27,7 @@ sub with_one_step {
 sub find_solution {
   my ($self) = @_;
   my $state = $self->current_search_state;
-  while ($state and $state->next_proposition) {
+  while ($state and (not $state->is_solution_state)) {
     $state = $state->with_one_step;
   }
   return undef unless $state;