Re: [Jprogramming] Advent of Code Day 22

2022-01-12 Thread 'Mike Day' via Programming
Yes, it was late! Inversion, not transformation, but not directly relevant; just the alternating signs. And yes, I probably learnt about the intersecting sets but had forgotten. Googling intersecting rectangles or cuboids didn’t reveal much of use. So I was quite pleased with my (re)discover

Re: [Jprogramming] Advent of Code Day 22

2022-01-12 Thread 'Michael Day' via Programming
I thought I'd try running this code,  but it failed on parse.  Must have been my data, I thought, so I tried parse sample,  which is defined in the following script.    parse sample |assertion failure |   7=#t-._ __ I'm running J903-a,  same as Raul, I think,  under Windows 11, which is di

Re: [Jprogramming] Advent of Code Day 22

2022-01-12 Thread 'Michael Day' via Programming
Whoa!  I've just tried    use sample which did work ok. Mea Culpa Mike On 12/01/2022 13:24, 'Michael Day' via Programming wrote: I thought I'd try running this code,  but it failed on parse.  Must have been my data, I thought, so I tried parse sample,  which is defined in the following script

Re: [Jprogramming] Advent of Code Day 16

2022-01-12 Thread Stefan Baumann
I didn't get a grip on this problem at the beginning and skipped it. But inspired by Raul's solution it appeared that the problem input looks like an encoded LISP expression. So I tried to parse the data into a LISP-like J expression and was wondering if I could then apply ". on it. The parsing ver

Re: [Jprogramming] Advent of Code Day 22

2022-01-12 Thread 'Michael Day' via Programming
OK, sorry about the alarm just now.  I'd misunderstood how to apply parse. FWIW,  I ran b22 and my "reboota" on "sample" which I'd called "bigexsteps" (big example steps) and on my bespoke data set,  called "data" for some reason. "reboot2a" is a much slimmer version of "reboot2".  reboot2 perf

Re: [Jprogramming] Advent of Code Day 16

2022-01-12 Thread Raul Miller
I think you could use X ;: bits where bits is a sequence of '0' and '1' characters, if you used ;: opcode 6 (stop) on reaching the payload part of the packet. An example implementation would then interpret the first word of the result as the puzzle opcode. If the opcode was 4, it would interpret t

Re: [Jprogramming] Advent of Code Day 22

2022-01-12 Thread 'Michael Day' via Programming
I've now modified reboot2a - it's now reboot2b (!) - to accumulate volumes of repeated intersection cuboids. It performs significantly better than reboot2a,  whose time & space I reported earlier,  in the msg below this one:     ts'reboot2b data'    NB. ~6x faster, ~5x smaller 0.229044 1.2546

[Jprogramming] Advent of Code Day 23

2022-01-12 Thread Raul Miller
https://adventofcode.com/2021/day/23 For day 23, we needed to solve a lazy shrimp problem. We had a room and hallway setup (view in monospace font): sample=:];._2 {{)n # #...# ###B#C#B#D### #A#D#C#A# # }} Ignore spaces and '#' (wall) characters. The important loc