adventofcode

Filip Strajnar 2021-12-19T19:53:53.220500Z

alright so I've already shortened day 1 part 1 code to this long, but I'm trying to find out if there is an even shorter way of writing this

(defn
  by-indicies
  [lines]
  (count (filter #(< (Integer/parseInt (nth lines %)) (Integer/parseInt (nth lines (inc %)))) (range (dec (count lines))))))

R.A. Porter 2021-12-19T19:56:59.222400Z

You might want to check the pinned thread for day 1 - https://clojurians.slack.com/archives/C0GLTDB2T/p1638336618055100?thread_ts=1638336618.055100&amp;cid=C0GLTDB2T

R.A. Porter 2021-12-19T19:58:24.222700Z

partition was popular on that day.

Filip Strajnar 2021-12-19T19:59:21.222900Z

thanks sooo much, very helpful

Filip Strajnar 2021-12-19T19:59:33.223100Z

I'm gonna look up how partition works, seems interesting

Filip Strajnar 2021-12-19T19:54:04.220800Z

i'm just trying to make really really short solution

Filip Strajnar 2021-12-19T19:54:14.221Z

i'm aware it's not the most readable one

Filip Strajnar 2021-12-19T19:55:21.222200Z

essentially it gets a range of the array of inputs, each index is put through this anonymous function to check if next number is greater than current, and count the filtered list

Aleks 2021-12-19T04:48:20.212700Z

🧵Day 19 Solutions Thread: post your solution here

2022-02-01T22:37:37.169439Z

whew…just completed mine. Had to do a lot of gymnastics for this one, including caching, r/fold and trying generally not to do more work than needed - with all my efforts, solution ends up being over 4 mins 😞

Miķelis Vindavs 2021-12-19T09:19:39.215400Z

Turns out finding 6 overlaps is enough. I forgot to change the limit from running the sample input, but still got the right answer

nbardiuk 2021-12-19T11:44:48.215700Z

runs over a minute but I don't have any more time to optimize https://github.com/nbardiuk/adventofcode/blob/master/2021/src/day19.clj

👏 3
Aleks 2021-12-19T12:21:19.216200Z

finally solved it 🙃

🕺 1
Antonio Bibiano 2021-12-19T13:06:43.216600Z

so strange I can find the overlap on half the example

Antonio Bibiano 2021-12-19T13:07:05.216800Z

but not on the other half

nbardiuk 2021-12-19T14:01:28.217400Z

I had similar symptoms, the problem was in the rotations

Antonio Bibiano 2021-12-19T14:09:59.217600Z

yeah I figured is something like that... still haven't found a fix

Callum Oakley 2021-12-19T15:04:10.217800Z

urgh. takes over 10 minutes… 😬 https://github.com/callum-oakley/advent-of-code/blob/main/src/aoc/2021/19.clj

Miķelis Vindavs 2021-12-19T16:30:36.218200Z

For some reason my solution only runs if I include all 48 transformations (24 + mirroring which according to the text shouldn't be allowed).. were you all able to solve it with 24 rotations?

1
Antonio Bibiano 2021-12-19T17:31:48.218400Z

I am also running with 48 transformations, but just because i was too invested in getting the thing to run to fiddle more with coordinate transformations 😄

euccastro 2021-12-19T17:43:56.218600Z

Mine takes >13 minutes. I'll only try optimizations if I can think of any interesting/fun ones: https://github.com/euccastro/advent-of-code-2021/blob/main/day19.clj

euccastro 2021-12-19T17:44:02.218900Z

very brute force

euccastro 2021-12-19T17:50:38.219100Z

but works with 24 transformations @mikelis.vindavs (I generated a superset of those and filtered by determinant being 1)

1
Antonio Bibiano 2021-12-19T20:35:01.223800Z

This is what I came up with.. some seriously cursed code find-path and get-one-path to figure out which chain of coordinate changes to apply to a point once i have the overlaps..

Aleks 2021-12-19T20:52:09.224200Z

A bit cleaned up my solution https://github.com/zelark/AoC-2021/blob/main/src/zelark/aoc_2021/day_19.clj ~7 secs

🤯 1
👌 1
Aleks 2021-12-19T20:53:43.224500Z

@mikelis.vindavs I ended up with 24 orientations

Aleks 2021-12-19T20:55:24.224700Z

an example for x axis, y and z follow the same pattern

;; orientations for x axis
;; [+x +y +z]
;; [+x -z +y]
;; [+x -y -z]
;; [+x +z -y]
;; [-x +y -z]
;; [-x +z +y]
;; [-x -y +z]
;; [-x -z -y]

Aleks 2021-12-19T20:56:38.224900Z

I was rotating Rubik’s cube to understand it 🤯

Antonio Bibiano 2021-12-19T21:48:58.227400Z

These last days I was really just kicking the code into some shape that works and barely any time left to re-think my approach :(

2021-12-19T22:44:41.231300Z

https://gitlab.com/maximoburrito/advent2021/-/blob/main/src/day19/main.clj when you keep adding garbage code onto other garbage code until you make it print the number you want. ughhh... I had this mostly done last night, but I was struggling not realizing that what I really needed to do was merge all the points. I'm sure there's actual sane ways to have coded this, but it's really hard to care at this point.

kevinc 2021-12-20T02:58:53.232400Z

https://github.com/kconner/advent-of-code/blob/master/2021/19a.cljhttps://github.com/kconner/advent-of-code/blob/master/2021/19b.clj. Not happy with my running time (6 minutes), and I don't know Clojure concurrency well enough to race several searches for the first successful match.

kevinc 2021-12-20T02:59:01.232600Z

I did come up with one useful insight: for any vector [a b c], its valid 90 degree rotations are all those with 1. the same cyclic ordering (b c a, c a b…), with an even number of negations (-a -b c, but not -a b c), or 2. the opposite cyclic ordering (c b a, etc.) with an odd number of negations (-c -b -a, -c b a, but not -c -b a).

kevinc 2021-12-20T03:05:08.233Z

great thinking re: overlap. I should have known there was excess work being done on my equivalent to that

2022-02-02T21:12:32.840199Z

Wow, just switched to the direct point comparison alg. Now, together with caching and || threads, under 4 seconds!

2021-12-19T05:08:22.213200Z

Wondering if should just some early sleep tonight :)