use is_solution_state flag in find_solution
Matt S Trout [Sat, 25 Jun 2016 16:47:36 +0000 (16:47 +0000)]
lib/DX/SearchProcess.pm
lib/DX/Step/Backtrack.pm

index 437f71d..cb50a2f 100644 (file)
@@ -27,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;
index f211c73..5fdfbc7 100644 (file)
@@ -13,7 +13,7 @@ sub apply_to {
     current_hypothesis => $first_alt->[0],
     alternatives => \@rest_alt,
     next_step => $first_alt->[1],
-    is_solution_step => 0,
+    is_solution_state => 0,
   );
 }