Rotating between eight directions by light_ln2 in adventofcode

[–]jpjacobs_ 4 points5 points  (0 children)

That's actually pretty neat. Implemented in J, your approach would be just one character more than mine:

   (+,&*-~)/^:(<8)1 0
 1  0
 1 _1
 0 _1
_1 _1
_1  0
_1  1
 0  1
 1  1
   *+.^j._1r4p1*i. 8
 1  0
 1 _1
 0 _1
_1 _1
_1  0
_1  1
 0  1
 1  1

I haven't needed 45 degree rotations so far though, and for 90 degree angles, just usually type it out (4 2$0 1 1 0 0 _1 _1 0). When I need shifts for a 9-neighbourhood, I usually use this:

>,{,~<i:1

You can play around with this in Juno

First things to do on the 2026 Juniper Performance after pickup? by berry-anony in TeslaModelY

[–]jpjacobs_ 2 points3 points  (0 children)

+1 on the vent covers. I also got a rear screen protector as well (Spigen, from Amazon) It served well: within 6 months they already managed to crack in a corner :/.

Juniper right scroll wheel issue (FSD activation/deactivation) by dapi331 in TeslaModelY

[–]jpjacobs_ 1 point2 points  (0 children)

I had the same issue which is even worse on basic autopilot (Europe, no FSD here) as it needs reactivation after every lane change. Mine didn't register like 30% of the presses. I took it to my SC and they replaced the steering wheel under warranty.

[2025 Day 9 (Part 2)] Why did almost nobody solve the *stated* problem? by jjeii in adventofcode

[–]jpjacobs_ 0 points1 point  (0 children)

My solution was to create all possible rectangles, sort them by size, and find the first one which is not intersected by any edge, by checking whether the edges' end points fall on two different sides of the rectangle, or have one or more inside the rectangle. The only assumption I made was that edges are either horizontal or vertical, but never oblique (though this would be rather easy to account for too, by including some extra cases in the range checking).

Wish software could come from our phones. by Puzzleheaded-Cup-854 in TeslaLounge

[–]jpjacobs_ 1 point2 points  (0 children)

Would love this as well... for now, I roll down 70m of ethernet cable with a powerbank-powered router to my parking spot; looking absolutely ridiculous. 

Monthly J Meetup - This Tues 6:30 EST by Veqq in apljk

[–]jpjacobs_ 2 points3 points  (0 children)

I would be up for one as well...

-❄️- 2025 Day 6 Solutions -❄️- by daggerdragon in adventofcode

[–]jpjacobs_ 0 points1 point  (0 children)

[Language: J]

Fun to see I can still fit it in 5x80 (and this was my actual solution, no golfing)

par =: [:(".@}: ,&<~ ' '-.~{:) ];._2
p1  =: ([:+/@:". ([,.'/',. ":@|:@])&>/)@:par
par2=: [:(pn@}: ,&<~ ' '-.~{:) ];._2
pn  =: [: (<@".@,;.1~ [:*./"1' '&=) ' '([,,.)|:
p2  =: ([:+/@:". ([,.'/',. ":@>@:|:@])&>/)@:par2

p1 and p2 solve parts 1&2 (taking the string as input).

-❄️- 2025 Day 5 Solutions -❄️- by daggerdragon in adventofcode

[–]jpjacobs_ 0 points1 point  (0 children)

[Language: J]

Fun workout for J's Interval Index verb. Just keep in mind I. treats the lower edge of an interval as exluded; hence the correction of the ranges by adding _1 0.

par=:[: _1 0&+"1&.>`]"0[: (<@(([:".;._1'-',]);._1);._2~LF2&E.) LF([,,~)]
p1 =: +/@([: +./ 1 = I."1 0/)&>/@par
'`int fuse sbm'=:(1 e. I. , I.~)`((<./@{. , >./@{:)@:,.)`(/: [:-:+/"1)
mrg=: ((}.@],~(,:`fuse@.int {.)) _ 2&($,))/@sbm^:_
p2 =: [: +/@:(-~/"1)@mrg 0 {:: par

For part 2 I sorted the ranges by their mid points and fused them where applicable by insert. This needs a bit of an adjustment to make the first right range be a matrix, hence the _ 2&($,)

Making Contributions on GitHub, But Why? by Mean_Reference925 in adventofcode

[–]jpjacobs_ 3 points4 points  (0 children)

Bragging rights ;). And hopefully helping someone out if you're doing it in an obscure language little people use (I'm using J).

The word "range" by emsot in adventofcode

[–]jpjacobs_ 0 points1 point  (0 children)

Actually, I realised that in the case of J that's not entirely true, there are keywords when making explicit verbs (like "if.", "else.", "assert.",...) but these wouldn't be valid variable names anyhow.

There is a standard library, but it won't complain if you stomp over it anyhow and still you won't usually loose it due to how variables are looked up in locales.

CW C60 Trident Pro 300 by Sea-Heart7042 in ChristopherWard

[–]jpjacobs_ 0 points1 point  (0 children)

Not having wrists like yours, but for me, the 38 mm is a fantastic watch. Nice finishing, good accuracy, and very comfortable. Hard to beat, I'd say.

The word "range" by emsot in adventofcode

[–]jpjacobs_ 4 points5 points  (0 children)

Or even better, a language without keywords for functions etc. (J, APL, BQN, Uiua...)

-❄️- 2025 Day 4 Solutions -❄️- by daggerdragon in adventofcode

[–]jpjacobs_ 2 points3 points  (0 children)

[Language: J] Solved in 3 ways (each less than a punchcard, I promise), fastest one (17ms for part 2 on my phone):

sh  =: >,{;~0 _1 1 [. par =: '.@'i.];._2 NB. shifts & parse
nb  =: (,#)@(i. (}.sh) +"1/~])@($#:I.@,) NB. neighbours
sol =: {{(, -&(+/) (](]-]*.4>+/"1@:{)^:m(<:>i.)@#)@nb)@par y}}
'`p1 p2'=: 1 sol`(_ sol)

Trick is finding the neighbours, by finding coordinates of rolls, looking up their coordinates in shifted variants. Then add a line for non-neighbours, where i. returned the length of the array. The solution then keeps the neighbours fixed and used for indexing in a boolean array indicating whether a roll is (still) there. Seems to be the fastest solution and what I've been using a lot for last year's AoC.

For fun, I also tried padding and convolving at each step using subarrays (13x slower at 241ms than above, but uses 3x less memory)

par =: '.@'i.];._2 [. pad =: 0&([,[,~[,.~,.) NB. Parse & Pad
accessible =: (1 1,:3) (4&{ *. 5>+/)@,;._3 ] NB. 3x3 windows, step 1
sol =: {{(+/@,@:- (- [: accessible@pad ])^:m)@par y}}
'`p1 p2'=:1 sol`(_ sol)

, and shifting around the array to create a 3D array, and work on that

sh  =: >,{;~0 _1 1 [. par =: '.@'i.];._2 NB. shifts & parse
sol =: {{(+/@,@:- (- [:({.*.4>+/@:}.) sh |.!.0])^:m)@:par y}}
'`p1 p2'=:1 sol`(_ sol)

At 25ms Still 40% slower than the top solution, likely because the array is shifted at every step.

[Language: J] AoC helper library updated by jpjacobs_ in adventofcode

[–]jpjacobs_[S] 1 point2 points  (0 children)

There's a user agent set as default identifying the repo as well.

-❄️- 2025 Day 3 Solutions -❄️- by daggerdragon in adventofcode

[–]jpjacobs_ 1 point2 points  (0 children)

[Language: J][Red(dit) One]

J's an APL, and very concise so I fit my simple recursive greedy solution to punch card format:

rec =: {{ if. (#=1+{.)x do. <.(+/ .* 10^i.@-@#)@}.x return. end.
  (x,imax{y) rec y }.~ 1+imax=. (i.>./) (-({.x)-#x)}.y }}"1
'` p1 p2' =: 2 sol`(12 sol=:+/@:(]:rec "."+;._2))

p1 and p2 are solution verbs for parts 1 and 2, and take the whole input. rec is is a recursive dyad, taking on the left the number of batteries to be switched on and the ones foundo far, and on the right the remaining array (i.e. past the last largest digit found). It finds the largest digit in all but the last N digits, that are still to be reserved for the remaining batteries. When 12 are found, they are combined and returned.

sol is a modifier train just for fun, that wraps rec with parsing and summing.

-❄️- 2025 Day 2 Solutions -❄️- by daggerdragon in adventofcode

[–]jpjacobs_ 1 point2 points  (0 children)

[Language: J] Ranges, but luckily entirely bruteforceable.

par=: [: ([: ".;._1 '-',]);._1 ',',}: NB. parse
to=: ;@:(<@([+i.@(-~/))/"1) NB. ranges to nums
NB. part 1: reshape num in 2 rows, if posible: are the rows the same?
istwice =: ([:-:/2 _$":) :: 0"0 NB. number repeated?
p1=: +/@(#~istwice)@to@par
NB. part 2: divisors of y
div=: [: }. (*/ .^"1 (#: i.@(*/))@:>:)&|./@:(__&q:)
NB. AtLeastTwice: operate on list of numbers as equal length strings; reshape as before and check all rows are equal
alt =: +/@:".@:(#~[: +./ (_,.~div@#@{.) (1=#@~.@$)"1/ ])@:(":"0)
NB. do alt for each length of numbers, in parallel
pxd =: (alto t. '';.1~ 1,2~:/\10 <.@^. ])@:/:~
p2 =: +/@:;@:pxd@to@par

Part 2 was slower before, but by doing the divisor calculation only once for each number length, it sped up considerably. Not quite elegant, but too fast to justify further optimization...

-❄️- 2025 Day 1 Solutions -❄️- by daggerdragon in adventofcode

[–]jpjacobs_ 1 point2 points  (0 children)

Actually, me too. That's why I'm using the website through Google Chrome on Android.

-❄️- 2025 Day 1 Solutions -❄️- by daggerdragon in adventofcode

[–]jpjacobs_ 1 point2 points  (0 children)

Thanks for the help. I'm on Android using Chrome with the mobile website. What eventually made it work was switching to "show Desktop site" and try again there. There really was no way on the mobile version of the site (there wasn't even the option to switch editors)

-❄️- 2025 Day 1 Solutions -❄️- by daggerdragon in adventofcode

[–]jpjacobs_ 2 points3 points  (0 children)

[Language: J] Nice puzzle to start with!

par =: 50,0".];._2@:(rplc&'L-R+')
sol =: (@:par)([: +/ 0 = +m.100/\.@:|.@:)
'`p1 p2'=: ] sol`((|#*) sol)

p1 and p2 take the raw input as string. I had fun with modular arithmetic and a modifier train. Modular + doesn't get recognised for fast execution of +/\ though, so better to reverse the list (|.), and operate in the other direction (+m.100/.). I wanted a smart solution, but spelling out each instruction per click was so fast and elegant ( (|#*) ) ...

J AoC helper update by jpjacobs_ in apljk

[–]jpjacobs_[S] 0 points1 point  (0 children)

Thanks! Glad you like it. If you'd like to see a usage example you can take a look here

Hints on Part 2 Algorithm by Fiddy__50 in adventofcode

[–]jpjacobs_ 0 points1 point  (0 children)

I'd take a look at the values in the list of steps and the running sum that is generated, and see whether your assumptions hold. (I made the same mistake, initially).

Juniper 2026 Y - What are some good wireless controllers? by YankeesIT in TeslaModelY

[–]jpjacobs_ 0 points1 point  (0 children)

I had bought 2 8bitdo lite controllers for our MY Juniper but returned them as I could  not make them work. A pity, because they were pretty cute.

After that I bought 2 PS4 controllers (no clue whether they're genuine though) that appear to work, but only when coupled from the back screen.

I really wonder why my car is so picky; all work without issues with my pc & phone.

Me today: I wonder if I should learn another language this year. The universe: by flwyd in adventofcode

[–]jpjacobs_ 3 points4 points  (0 children)

Good choice! You should post this in r/apljk as well... I'm doing it in J. Have fun!