[Jprogramming] Advent of Code Day 12

2022-01-01 Thread Raul Miller
https://adventofcode.com/2021/day/12 For day 12, we had a "cave map" which was a list of connections between named pairs of rooms. unpack=:-.&;:&'-';._2 sample=: unpack {{)n start-A start-b A-c A-b b-d A-end b-end }} Here, our puzzle task, for part A, was to explore the cave system. We needed t

Re: [Jprogramming] Advent of Code Day 11

2022-01-01 Thread Jan-Pieter Jacobs
My take on Day 11 followed roughly the same approach, but with a tacit step function. Likely, the solution verbs a11 and b11 could be made tacit as well, but as they're so simple, I did not bother. NB. Day 11: Bioluminescent dumbo octopus flashes i11=: "."0 ;._2 in 11 NB. how many flashes in 100 s

Re: [Jprogramming] Advent of Code Day 9

2022-01-01 Thread Jan-Pieter Jacobs
Hi Mike, I'm glad my code was useful. If I recall correctly, I picked up the connected component approach from how it's implemented in Matlab ( https://nl.mathworks.com/help/images/ref/bwconncomp.html), although I don't exactly recall whether that uses the shifting. The (excellent) Learning J book

Re: [Jprogramming] Advent of Code Day 8

2022-01-01 Thread Raul Miller
I like this approach, Actually, we could ignore 8 (because that's just "all segments"), but if we are using intersect ([ -. -.) then 8 is our neutral value. dcnt=:#@~.@-.&' .'@,S:0 unpack=:{{(b#|:y)<@|:/.~b#+/\-.b=.-.*/y=' '}} digits=:unpack ];._2 {{)n

Re: [Jprogramming] Advent of Code Day 11

2022-01-01 Thread Raul Miller
On Sat, Jan 1, 2022 at 9:28 AM 'Michael Day' via Programming wrote: > I can never remember the tessellation idiom when I need it, ... I have problems with this, also. So I made it a point, during AoC, to try it out every few days so that my memory could remain fresh. I tried a variety of exampl

Re: [Jprogramming] Advent of Code Day 9

2022-01-01 Thread Michael P. Manti
Jan-Pieter, The use of shifting and padding to produce multiple tables and then operating on those tables was illuminating to me. I often find myself writing verbs to process lists and then applying them to tables by transposing or fiddling with the rank conjunction. For example, this was my s

Re: [Jprogramming] Advent of Code Day 8

2022-01-01 Thread Stefan Baumann
Solved part 1 similarly. Not sure if I've got something new for part 2, but my main insight was that each number is uniquely defined by it's "segment intersections" with the numbers 1, 4 and 8. Calculating those from a normalized input and applying them to the left side gives me the numbers represe

Re: [Jprogramming] FW: full version

2022-01-01 Thread Raul Miller
At least it's working now. (Probably the thing to do here would be to fork busybox and ensure that the fork we use reports errors when files are not unpacked. (I checked for active development of busybox, and it looks like currently that is not happening -- instead, I find messages from people hav

Re: [Jprogramming] FW: full version

2022-01-01 Thread R.E. Boss
Thanks, but before I read your reaction, I installed J903 under 'user' with as result JVERSION Engine: j903/j64avx2/windows Release-a: commercial/2021-12-16T15:15:09 Library: 9.03.08 Qt IDE: 1.9.5/5.15.2(5.15.2) Platform: Win 64 Installer: J903 install InstallPath: c:/users/reb/j903 Contact: w

Re: [Jprogramming] Advent of Code Day 11

2022-01-01 Thread 'Michael Day' via Programming
Yes,  the second part was again pretty trivial,  at least when, as in J,  you can use the power operation. I seem to have solved it on my iPad, running iOS 12.5.5,  which is too obsolete to support Ian Clark's new J902 version,  so it's stuck in J701,  so not up to {{ }} and lots more. I can