AI-Pathfinding-AStar
view release on metacpan or search on metacpan
Revision history for Perl extension AI::Pathfinding::AStar.
0.10 Sun Jun 17 16:00:00 2007
- *sighs* A debugging remnant in the test files caused make test
to fail. This appears to fix it.
0.09 Sat Jun 16 19:00:00 2007
- I apologize. Revision number bumped due to distribution snafu.
0.08 Sat Jun 16 16:00:00 2007
- Major bug fixed that caused some paths to be incorrectly
determined due to an over-greedy implementation. Thanks, Flavio!
0.07 Tue Aug 08 07:00:00 2006
immediately surrounding nodes:
* Node ID
* Cost to enter that node
* Heuristic
Basically you should return an array reference like this: "[ [$node1,
$cost1, $h1], [$node2, $cost2, $h2], [...], ...];" For more information
on heuristics and the best ways to calculate them, visit the links
listed in the *SEE ALSO* section below. For a very brief idea of how to
write a getSurrounding routine, refer to the included tests.
As mentioned earlier, AI::Pathfinding::AStar provides two routines named
"findPath" and "findPathIncr". "findPath" requires as input the starting
and target node identifiers. It is unimportant what format you choose
for your node IDs. As long as they are unique, and can be distinguished
by Perl's "exists $hash{$nodeid}", then they will work. "findPath" then
returns an array (or reference) of node identifiers representing the
least expensive path to your target node. An empty array means that the
target node is entirely unreacheable from the given source.
"findPathIncr" on the other hand allows you to calculate a particularly
lib/AI/Pathfinding/AStar.pm view on Meta::CPAN
=over
=item * Node ID
=item * Cost to enter that node
=item * Heuristic
=back
Basically you should return an array reference like this: C<[ [$node1, $cost1, $h1], [$node2, $cost2, $h2], [...], ...];> For more information on heuristics and the best ways to calculate them, visit the links listed in the I<SEE ALSO> section below...
As mentioned earlier, AI::Pathfinding::AStar provides two routines named C<findPath> and C<findPathIncr>. C<findPath> requires as input the starting and target node identifiers. It is unimportant what format you choose for your node IDs. As long a...
=head1 PREREQUISITES
This module requires Heap (specifically Heap::Binomial and Heap::Elem) to function.
=head1 SEE ALSO
L<http://www.policyalmanac.org/games/aStarTutorial.htm>, L<http://xenon.stanford.edu/~amitp/gameprog.html>
t/01_AI-Pathfinding-AStar.t view on Meta::CPAN
#########################
package AI::Pathfinding::AStar::Test;
use Test::More tests => 6;
BEGIN {
use base AI::Pathfinding::AStar;
};
#########################
# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.
#initialize a basic map
#This example module represents the following map:
#
# . . . . . . .
# . . . | . . .
# @ . . | . . *
# . . . | . . .
# . . . . . . .
#
( run in 0.254 second using v1.01-cache-2.11-cpan-87723dcf8b7 )