Also, after reflection, it turns out that getting rid of the if statement was straightforward:
BLOCK=: {{ W=: x{::digits X7=: W~:/(x{B)+26|y ((W+x{A)*X7)+(1+25*X7)*"(X7 <.&#&$ t)t=.<.y%x{C }} By the way, in case it was not obvious -- the 7 (in X7) refers to the line number of that assignment to the X register. (Also the result here and, thus, the argument, is a Z register assignment. Despite all that register verbiage, the data flow here was quite straight forward.) And, ... there's probably other good simplifications, just waiting for me to notice them. FYI, -- Raul On Sat, Jan 15, 2022 at 4:18 PM 'Michael Day' via Programming <programm...@jsoftware.com> wrote: > > ... and it's one of those "days" that part 2 is ridiculously easy cf > part 1 !!! > > Mike > > On 15/01/2022 21:15, 'Michael Day' via Programming wrote: > > Yes, that's my guess. I called them p q & r, and found that p = 1 or > > 26 as q is positive or negative. > > > > So: having got one machine to run 14 times on different values of p q > > r and the previous Z, I worked back > > from Z = 0 output on the 14th machine, saving which W & Zs gave rise > > to 0, then using those Zs on the > > 13th machine .... > > > > But that gave me potentially a lot of Zs - I haven't counted - so I > > then worked forward from the first machine > > finding only 1452 14-ples giving rise to a final zero. Very messy - I > > didn't really code it - but it worked! > > > > Haven't got round to part 2 yet. > > > > Mike > > > > On 15/01/2022 18:12, Raul Miller wrote: > >> Actually, another caution here: it might be that other people's puzzle > >> inputs used a different block structure from my block structure. > >> > >> Probably not -- it's probably the case that only my A, B and C values > >> differed for different people. But .. that's just "probably" because I > >> haven't looked at other people's puzzle input. > >> > >> FYI, > >> > > > > > -- > This email has been checked for viruses by Avast antivirus software. > https://www.avast.com/antivirus > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm