To "brute force" the problem I pre-computed:
delcyc - a cycle table where each row is a scanner cycle delayed by the
level number.
lencyc - a list of scanner cycle lengths (twice the "scanner depth" - 1).
I calculate the index of the scanner positions with a modulo of the tick :
(<"1 (i.44),.lencyc|tick){delcyc
3 0 1 1 1 3 5 5 3 3 1 5 7 1 3 1 7 3 3 1 13 9 11 9 7 5 3 1 1 9 7 5 1 1 1 5 7
9 11 13 5 8 10 12
Testing could be done with 0&e. but I suspect */ is faster:
*/ (<"1 (i.44),.lencyc|tick){delcyc
0
On Sat, Dec 23, 2017 at 2:25 PM, '[email protected]' via
Programming <[email protected]> wrote:
>
> Thanks - so, knowing solution was possible in seconds, I cleaned up my
> approach, also using blocks, but specifiying their size in advance.
>
> Rather surprisingly, it's somewhat faster than Raul's - maybe because
> it
> keeps more constant data between block-loops.
>
> It uses that property I tried explaining to Brian Schott, but
> incorrectly,
> I now realise. The property should be that the probe is detected if
> the range's
> cycle period divides the (depth plus the delay) exactly.
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm