They are locations that are unique. And they can be converted into
either number of steps to that location or into a sequence of steps to
reach that location:
nsteps=: +/@:|"1
path=:3 :0
r=.''
while. 0<+/|y do.
pick=. (i. <./) +/"1|dss -~"1/ y
y=.y-pick{dss
r=.r,pick{nms
end.
)
Beware, however, that arbitrary sequences of three integers (or half
integers) are not necessarily valid locations (we are working with a
two dimensional grid here, so those three numbers cannot be completely
independent of each other). Here's a variation of path which catches
that issue:
apath=:3 :0
o=. y
r=.''
while. (o >:&(+/@:|) y) * 0<+/|y do.
o=. y
pick=. (i. <./) +/"1|dss -~"1/ y
y=.y-pick{dss
r=.r,pick{nms
end.
assert. 0=+/|y
)
Thanks,
--
Raul
On Sun, Dec 17, 2017 at 1:33 PM, Brian Schott <[email protected]> wrote:
> Raul,
>
> Maybe I misspoke again.
> I debugged location and looked at the following result.
>
> _3{.+/\dss{~nms i.y
> 348.5 _242.5 _106
> 348 _242 _106
> 348 _241.5 _106.5
>
> Are those locations that you can read and are they unique?
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm