AI-Pathfinding-SMAstar

 view release on metacpan or  search on metacpan

lib/AI/Pathfinding/SMAstar/Examples/Phrase.pm  view on Meta::CPAN

			else{
			    $phrase = $cand . " " . $phrase . "";	
			}
		    }
		}
		elsif($direction == 1){
		    if($ant_direction == 0){		    
			$phrase = "" . $phrase . " " . $cand;
			
		    }
		    elsif($ant_direction == 1){
			$phrase = $cand . " " . $phrase . "";
		    }
		}
	    }
	}
	
	$pobj = $pobj->{_predecessor};
	$depth++;
	
    }  # end while($pobj);
    
    return $phrase;
}




sub roll_up_phrase_plus_word
{
    my ($self) = @_;

    my $phrase = $self->{_phrase};
    my $word = $self->{_start_word};
    my $phrase_plus_cand = $phrase . ": " . $word;

    return $phrase_plus_cand;
}




sub DESTROY
{
    my ($self) = @_;

    my $antecedent;
    my $ant_phrase;

    my ($pkg, $filename, $line_num) = caller(); 

    if($self->{_predecessor}){
	$antecedent = $self->{_predecessor};
	$ant_phrase = $antecedent->{_phrase} ? $antecedent->{_phrase} : $antecedent->{_start_word};
    }
    else{	
	$antecedent->{_phrase} = "none";
    }

#    print "     $line_num, destroying phrase object $self, '" . $self->{_start_word} . ", " . $self->{_phrase} .
#	"', parent is $antecedent: '" .  $ant_phrase . "' \n";
    
#    if($line_num != 0){ # if not final sweep at program exit
#	print "        caller is: $pkg, $filename, $line_num\n";	
#    }
    
    if($line_num == 0){ # line_num is zero
	$d++;
#	print "\$d : $d\n";
    }
    
    #${$self->{_predecessor}} = 0;
    #${$self->{_descendants_list}} = 0;

    delete $self->{_predecessor};
    
   
}

































1;  # so the require or use succeeds



( run in 0.930 second using v1.01-cache-2.11-cpan-39bf76dae61 )