# Re: A85: Re: LaserSquad-Z

```
Well, the way I'm going to do it is that I store all
those "furthest examination points"

.t.xxxxx...
...x222x...
...x211x...
...x21sx...
...xxxxx...
...........
...........

t-target
s-start
x-stored

and their distance from the target. Hmm... good
storing ideas are needed :) I think a list consisting
x and y coordinates and a list of distances from the
target would do.

dist_list:  db. 10,5,12,4,7;this would be a sorted
list
coord_list: db. 30,15, 30,10, 30,17, 30,9, 30,12

then my A* version(or maybe it is the 'best first
search') will check the distance list for the lowest
value(maybe a radix sort, or something) and then it
would pick the coordinates from the other list. After
that it would just check the surrounding <8 tiles...
if it gets stuck somewhere then it would search from
the next best coordinate according to the distance
list.  ...and then it would loop untill distance is
0(=route is clear).

Better ideas anyone? I'm not quite sure how good it
will perform when some objects appear, but that is to
be found out.

The other thing I'm worrying about is how big those
lists could easily get... Maybe after 100
entries(=co_list 200bytes+di_list 100bytes=300bytes) I
could just drop out the longest distances &
coordinates. Hmm... Any suggestions? Or just tell me
to shut up if I'm bothering you...

/Johannes Rajala

email: carrot@sgic.fi

--- David Whittaker <tubadave@sonet.net> wrote:
>
> Yeah, I saw that A* algorithm, too, but it looked to
> complicated to fit
> on a calculator.  You might could use a simplified
> version of it and
> create kind of a road map for the map.  You create
> an overlay (or use
> the extra bits) to make a hidden road that connects
> points.  Then you
> simply find the closest point, and follow the road
> to the closest point
> to your target.  You would still have to use the
> other algorithm, and
> homemade maps would all have to be two-player or
> something, but it would
> work, and should be faster.  It would just look
> really stupid if the
> unit went to the closest point if the target was
> right next to it, but
> you could have it look for the enemy, too.  This is
> how I understood A*
> to work..... If not I might like to use it someday,
> so could you explain
> it any better?
>
> Thanks,
> Dave

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

```