Fork me on GitHub
<
2021-12-19
>
alekszelark04:12:20

Miķelis Vindavs09:12:39

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

nbardiuk11:12:48

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
alekszelark12:12:19

finally solved it 🙃

🕺 1
Antonio Bibiano13:12:43

so strange I can find the overlap on half the example

Antonio Bibiano13:12:05

but not on the other half

nbardiuk14:12:28

I had similar symptoms, the problem was in the rotations

Antonio Bibiano14:12:59

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

Miķelis Vindavs16:12:36

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 Bibiano17:12:48

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 😄

euccastro17:12:56

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

euccastro17:12:02

very brute force

euccastro17:12:38

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

1
Antonio Bibiano20:12:01

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..

alekszelark20:12:43

@U89SBUQ4T I ended up with 24 orientations

alekszelark20:12:24

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]``````

alekszelark20:12:38

I was rotating Rubik’s cube to understand it 🤯

Antonio Bibiano21:12:58

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 :(

norman22:12:41

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.

kevinc02:12:53

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.

kevinc02:12:01

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).

kevinc03:12:08

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

kingcode22:02:37

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 😞

kingcode21:02:32

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

norman05:12:22

Wondering if should just some early sleep tonight :)

Filip Strajnar19:12:53

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. Porter19:12:24

`partition` was popular on that day.

Filip Strajnar19:12:21

Filip Strajnar19:12:33

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

Filip Strajnar19:12:04

i'm just trying to make really really short solution

Filip Strajnar19:12:14

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

Filip Strajnar19:12:21

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