On Thu, Dec 17, 2009 at 2:18 PM, David Ward Lambert <[email protected]> wrote: > A =. 1(<4 4 4)}(9 9 9){.0 NB. 9 cube, true in center > > > Repeat 3 times: > rotate A 1 unit up, down, right, left, in, out, > combine the resulting 6 groups of data with "or" producing an array > having same shape as A. Also "or" the cells with A. > replace A with the result of those operations. > store the number of 1 bits in A. > result is the vector of 1 bits in A.
Perhaps something like this? A=: (i.9 9 9)=9#.4 4 4 next=: [: +./ (0,(,-)=i.3) |. ] A=: next^:3 A I am not quite sure what you want for your result, but perhaps this is enough to get you started? -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
