toomuchcookies / pgu

Automatically exported from code.google.com/p/pgu
GNU Lesser General Public License v2.1
0 stars 0 forks source link

algo.astar looks beyond layer; causes IndexError #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
algo.astar() takes a layer object, which is some object such that
layer[y][x] is an integer. During the course of pathfinding, it may look
outside the layer for nodes to go to, causing an IndexError if the
intuitive option of using a sequence of sequences is used. 

The user-end solution to this is to wrap unwalkable nodes around the edge
of the layer so that the algorithm would have no access to non-existent nodes.

I feel that on the implementation side, this behavior should be documented
(it is not intuitive to people that don't know pathfinding that A*, which
would in the end find a straight path from (0,0) to (0, 1), would look at
(-1, 0) or (0, -1) < http://paste.pocoo.org/show/114987/ >), or else that
pgu.algo.astar() should assume that nonexistent places on the layer (which
raise LookupError) are not walkable. The latter solution seems most
appealing to me.

Original issue reported on code.google.com by Jeanpier...@gmail.com on 29 Apr 2009 at 4:48

GoogleCodeExporter commented 9 years ago
astar now restricts itself to the given grid

Original comment by peter.ro...@gmail.com on 11 Aug 2009 at 2:27