Raul, Right, I remember now that you said that earlier in this thread. Obviously, I did not understand it then.
Thanks for your patience and great help, On Sun, Dec 17, 2017 at 2:06 PM, Raul Miller <[email protected]> wrote: > 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 > ) > > > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
