adventofcode

Happy Advent 2020! Please put answers in the pinned threads or create one if it does not exist yet. | https://github.com/adventofcode-clojurians/adventofcode-clojurians | Join the private leaderboard with code 217019-4a55b8eb
uneman 2018-12-10T00:02:09.185600Z

@mfikes At least you found a bug in core implementation. šŸ˜ƒ (BTW, I wish rrb-tree were under data.rrb-vector)

mfikes 2018-12-10T00:04:14.186200Z

Ahh it is a known issue. https://dev.clojure.org/jira/browse/CRRBV-20 But now I can perhaps file an easier repro.

mfikes 2018-12-10T00:14:57.187100Z

I added the failing AoC code to that ticket.

misha 2018-12-10T00:56:02.187500Z

deque, p2 "Elapsed time: 2390.909256 msecs"

misha 2018-12-10T00:57:56.188700Z

beware of calling (->> q (iterate f) (take x)) on mutable things :kappa:

misha 2018-12-10T01:06:36.189800Z

@mfikes TIL rrb-vector. efficient concatenation that could have kept my room temperature lower

2018-12-10T03:49:29.190600Z

K, loop/recur instead of reduce gets me down to 1.2s (from 2.6s)

2018-12-10T03:51:04.191Z

(still with homerolled circular doubly linked list)

theeternalpulse 2018-12-10T03:51:36.191500Z

I'm in the penalty box for day 3 hoping it's not telling me I'm wrong just because of one character lol

theeternalpulse 2018-12-10T03:52:04.192Z

I can't think of why my algo doesn't work but I think it's the format of the id, we'll see in 4 minutes

theeternalpulse 2018-12-10T03:59:35.192300Z

guess not šŸ˜ž

2018-12-10T04:18:19.192600Z

down to 500ms with ArrayDeque

1
gklijs 2018-12-10T04:35:19.192800Z

A transient vector wouldn't do it? I might give it a try with transient vectors. I don't think it should be a lot slower then Java.

mattly 2018-12-10T05:43:38.194400Z

day 10 is kinda fun, there's not really an easy way to determine the correct answer programatically, you have to start printing output at some point

2018-12-10T05:44:12.194900Z

There is a way

gklijs 2018-12-10T05:44:37.195600Z

I was wondering, you could probably have some 'statistic' like n alligned stars

gklijs 2018-12-10T05:44:56.196300Z

Or maybe when there most close together?

šŸ‘ 1
mattly 2018-12-10T05:45:25.196800Z

heh, yeah

mattly 2018-12-10T05:45:44.197200Z

ok, that's fair

mattly 2018-12-10T05:46:32.198800Z

I brute-forced it and simply printed anything with a certain compactness

2018-12-10T05:47:24.199700Z

I mean technically, I suppose it you could make an input where the right answer was one or two off from that, so thereā€™s no guarantee, but itā€™ll certainly get you in the ballpark. And, in may case it was exactly right

mattly 2018-12-10T05:48:32.200100Z

note I did say "easy"

mattly 2018-12-10T05:48:38.200300Z

šŸ˜›

mattly 2018-12-10T06:00:58.203900Z

Oh I suppose you could just stop when it starts growing again

ā˜ļø 1
2018-12-10T11:36:18.222400Z

that worked from the first try for me, stopped once the width started growing šŸ‘Œ

2018-12-10T06:02:26.205400Z

What would be really fun, for another day, would be to write something that would find the local minimum more efficiently than stepping by 1

mattly 2018-12-10T06:03:22.206500Z

Yeah

2018-12-10T06:03:43.207200Z

I wrote mine to take a range of steps and than checked each 1000 or so until I got in the area

mattly 2018-12-10T06:04:01.208Z

I waited until the height was less than 30

helios 2018-12-10T08:53:31.219700Z

Yeah that was the easiest direction. I had it run for 100k iteration and saw what was the minimum distance, and I tried to print that. Luckily it worked at the first go, but otherwise I would have only printed the (hopefully not many) iterations in which the distance was less than a threshold.

helios 2018-12-10T08:54:11.219900Z

The interesting bit is that this approach is far from being guaranteed to produce a good result. I wonder how you could "see" letters in the text šŸ˜„

2018-12-10T06:06:54.210800Z

seems reasonable. I used total area. I guess when you have to read a display out many, any heuristic that gets you there is valid

taylor 2018-12-10T06:21:41.211300Z

Iā€™m having trouble making any sense out of mineā€¦

2018-12-10T06:40:02.211800Z

As in you arenā€™t converging to letters?

taylor 2018-12-10T06:40:43.212500Z

yeah I went straight to a visualization approach w/Quil and Iā€™m finding it hard to pick out the exact frame as things converge

fellshard 2018-12-10T06:43:13.212900Z

I had an issue where all letters but the last were capital

fellshard 2018-12-10T06:43:20.213200Z

... and the last letter was a lower-case 'L'

fellshard 2018-12-10T06:43:22.213400Z

šŸ˜

fellshard 2018-12-10T07:00:04.214Z

Also, is there a 'safe' way to use Quil from CIDER? I ended up hopping over and drawing everything to a PPM instead

fellshard 2018-12-10T08:47:32.219300Z

Not so much unsafe as acting strangely. When I'd close the opened sketch frame, it would cause the repl to freeze up to the point I had to kill it, because emacs would stutter consistently while editing.

fellshard 2018-12-10T08:47:45.219500Z

There was an error message in the minibuffer, I'll see if I can replicate it later.

taylor 2018-12-10T07:06:25.214800Z

whewā€¦ in hindsight I shouldā€™ve used an algorithmic approach, wasted a lot of time tinkering with Quil to get scale/speed rate to be able to see the letters

taylor 2018-12-10T07:06:39.215300Z

sorry, not sure

fellshard 2018-12-10T07:06:42.215500Z

Oh dear, you drew each step in Quil? šŸ˜¬

taylor 2018-12-10T07:07:10.216Z

yeah but I put in a bunch of logic to control the speed and scale to make it easier to spot the message

taylor 2018-12-10T07:07:21.216300Z

so a lot of steps get skipped

fellshard 2018-12-10T07:08:03.217300Z

It would be neat to see the zooming happen, at least, hopefully we get to see the results šŸ˜„

taylor 2018-12-10T07:08:28.217900Z

yeah, gonna polish it up and put it on YouTube and will post it here. Gotta go to bed soon though šŸ’¤

Average-user 2018-12-10T07:50:48.218Z

I've used quil with cider without problems. What do you think is unsafe?

gklijs 2018-12-10T07:54:03.218300Z

Quil seems cool to use for the problems, do you use it only for clj, or also cljs. For next year I might want to give that I try, used quil before for both java and javascript.

taylor 2018-12-10T14:30:22.230600Z

Iā€™ve only been running these on the JVM, but Iā€™m not using any JVM-specific functionality so I think they should all be easily portable to CLJS

uneman 2018-12-10T10:42:21.220100Z

made an animation for day10. very unattractive. šŸ˜–

2
šŸ‘ 5
helios 2018-12-10T10:45:16.220600Z

why unattractive? i actually think it's pretty cool šŸ˜„

šŸ™‡ 1
plexus 2018-12-10T11:08:50.221600Z

Today was a great excuse to use a library I've been working on for building console UIs šŸ™‚

plexus 2018-12-10T11:09:08.222300Z

still a bit rough around the edges but you can already do fun things with it: https://github.com/lambdaisland/trikl/

borkdude 2018-12-10T11:44:00.223200Z

day 10 seems like fun. Iā€™ll save it for later, short on time right now and my priority with AOC lies with keeping advent-of-cljc running

borkdude 2018-12-10T11:44:59.224Z

there was a memory issue because of the memoized state and delays that were built up in all the testing namespaces. now only new or changed solutions are tested on CI.

borkdude 2018-12-10T11:45:37.224600Z

if anyone knows a neat trick to destroy namespaces after tests are finished to free up memory, Iā€™m all ears

borkdude 2018-12-10T11:53:01.225100Z

is this channel logged somewhere? Iā€™d like to read the discussions after AOC is finished for the ones I didnā€™t get to yet

borkdude 2018-12-10T11:53:13.225400Z

@plexus you had this logging thingy running right?

plexus 2018-12-10T11:54:51.226Z

Updates once a day I believe

šŸ‘ 1
borkdude 2018-12-10T11:58:15.227100Z

@plexus I love terminal UIs. I got reagent working with react-blessed once: https://twitter.com/borkdude/status/1002623954320871426

plexus 2018-12-10T12:10:30.228100Z

Very nice! I ended up writing Trikl after I got dissatisfied with Lanterna and wanted some in native clojure

benoit 2018-12-10T12:58:26.228600Z

My solution for Day 10 https://github.com/benfle/advent-of-code-2018/blob/master/day10.clj

šŸ‘ 1
2018-12-10T14:22:04.229800Z

Thanks. This looks quite amusing.

taylor 2018-12-10T14:29:20.230200Z

day 10 visualized w/Quil https://www.youtube.com/watch?v=4YtCXEalgTw

šŸ‘ 5
ā¤ļø 4
šŸŒŸ 3
pesterhazy 2018-12-10T14:37:33.231200Z

looks amazing

taylor 2018-12-10T14:41:09.231800Z

Thanks! I spent perhaps too long tinkering with it haha

taylor 2018-12-10T14:41:51.232800Z

Very cool! Let me know if you post the code so I can compare approaches

uneman 2018-12-10T15:16:36.233500Z

@taylor https://github.com/namenu/advent-of-code-2018/blob/master/src/year2018/day10.clj I've slightly changed easing fn in repo, still the algorithm is same šŸ˜„

taylor 2018-12-10T15:21:36.234200Z

Thanks, learning some stuff from your approach

taylor 2018-12-10T15:54:52.234600Z

I took a totally different approach to easing (knowing next to nothing about animation) https://github.com/taylorwood/advent-of-code/blob/master/src/advent_of_code/2018/10.clj

uneman 2018-12-10T16:21:20.236Z

wow, thanks for your inspiring code!

šŸ¤ 1
misha 2018-12-10T16:22:38.236600Z

> (or (> width 80) (> height 10)))) :kappa: @mfikes

uneman 2018-12-10T16:24:10.236700Z

omg moving things were stars not elves šŸ˜± (not reading a description is a bad habit)

Average-user 2018-12-10T16:59:04.237900Z

Don't remember if it was in 2016 or 2015, but there also was like this one

Average-user 2018-12-10T16:59:10.238200Z

Like a grid that said something

taylor 2018-12-10T17:03:31.239500Z

it reminded me of one from last year where you had to determine when some points w/velocities were going to stop converging or something, very similar input and algorithm but didn't involve finding a message from the points

Average-user 2018-12-10T17:05:55.239700Z

Yeah me too

Average-user 2018-12-10T17:06:16.240100Z

How much time takes you part-1?

Average-user 2018-12-10T17:07:05.241600Z

And also, has someone been able to transform the grid to a string with the word?

taylor 2018-12-10T17:09:01.243300Z

to write the code, or run the visualization? Took me a couple hours to get the answer b/c I immediately went for visualization approach w/Quil instead of finding a heuristic for convergence, and I had a lot to learn about dealing with visualizing big spaces w/Quil and controlling animation speed such that I could read the message which is only legible for a handful of frames. Part 2 was easy b/c I just added a hack atom to track passage of time in my draw function

misha 2018-12-10T17:10:02.243500Z

. "Elapsed time: 3387.126557 msecs" part1 "Elapsed time: 3091.846753 msecs" part2 (same, but no drawing)

Average-user 2018-12-10T17:15:25.244300Z

don't know what I'm doing wrong, but it takes me 13000 msecs

Average-user 2018-12-10T17:18:20.245100Z

I think this would be all you need to know about my code:

Clojure
(defn step [points]
  (pmap (fn [[[x y] [vx vy]]] [[(+ x vx) (+ y vy)] [vx vy]])
        points))

(defn boundaries [points]
  (let [xs (map ffirst points)
        ys (map (comp second first) points)
        [maxx minx] [(reduce max xs) (reduce min xs)]
        [maxy miny] [(reduce max ys) (reduce min ys)]]
    [[minx miny] [maxx maxy]]))

(defn area [points]
  (let [[[x1 y1] [x2 y2]] (boundaries points)]
    (* (- x2 x1) (- y2 y1))))

(defn final-grid []
  (->> (parse-input)
       (iterate step)
       (map vector (range))
       (partition 2 1)
       (filter (fn [[[s p] [_ p']]] (> (area p') (area p))))
       (ffirst)))

Average-user 2018-12-10T17:19:19.245800Z

Ohh the problem was pmap, now takes 5s

misha 2018-12-10T17:20:01.246400Z

you pack/unpack a lot: (let [[[x1 y1] [x2 y2]] [[minx miny] [maxx maxy]] ;; (boundaries points)]

misha 2018-12-10T17:21:10.247100Z

offtopic: (map vector (range)) can be just (map-indexed vector)

misha 2018-12-10T17:23:01.248300Z

move velocities out as soon as you parse input. those do not change, and you pay all this packing/destructuring as a result

misha 2018-12-10T17:24:00.249400Z

then you might want to (map area) before partition. now you calculate it twice for each frame

misha 2018-12-10T17:25:22.250500Z

calculating maxx/maxy in one iteration will not hurt, now you scan all the points 6 times instead of once

misha 2018-12-10T17:25:36.250800Z

map, map, reduce, reduce, reduce, reduce, instead of 1 tiny-bit-uglier reduce

misha 2018-12-10T17:29:19.252100Z

also drop-while might return a bit earlier than filter

Average-user 2018-12-10T17:31:06.253800Z

Thanks, calculating areas before partition makes a lot of sense, should have thought of that (hehe). drop-while instead of filter probably wont change much but I'll try it out anyway

Average-user 2018-12-10T17:39:30.255400Z

Also, changed step and area to

(defn step [{:keys [points velocities] :as data}]
  (update data :points #(map (partial mapv +) % velocities)))

(defn bounds [{:keys [points]}]
  (let [xs (map first points)
        ys (map second points)]
    [[(reduce min xs) (reduce min ys)]
     [(reduce max xs) (reduce max ys)]]))
And makes the program slower

2018-12-10T17:47:40.255800Z

I second the original statement. Thanks for making me smile

šŸ¤ 1
misha 2018-12-10T17:47:51.256200Z

bounds still scans points 6 times :opieop:

misha 2018-12-10T17:48:41.256500Z

(defn frame [[[x y] & points]]
  (reduce
    (fn [[x1 x2 y1 y2] [px py]]
      [(min x1 px) (max x2 px)
       (min y1 py) (max y2 py)])
    [x x y y]
    points))

Average-user 2018-12-10T17:49:47.257300Z

Yeah ,I said that regarding your advice to separate points from velocities

misha 2018-12-10T17:50:45.257900Z

I meant:

(defn tick [velocities points]
  (map (partial mapv +) points velocities))
...
(->> points
  (iterate (partial tick velocities))
...

misha 2018-12-10T17:52:11.259Z

but I doubt it affected performance, rather - readability

Average-user 2018-12-10T17:53:14.259200Z

right

2018-12-10T17:56:30.259500Z

for the interested: https://www.twitch.tv/timpote

Average-user 2018-12-10T17:58:26.259900Z

Haven't done day10 yet?

Average-user 2018-12-10T18:23:14.260700Z

Anyways here is my Day10, thanks @mishafor the insights https://github.com/Average-user/adventofcode-clj-2018/blob/master/src/adventofcode_clj_2018/day10.clj

2018-12-10T19:44:32.261Z

I havenā€™t šŸ˜• starting to get tiredā€¦ šŸ˜›

2018-12-10T19:50:26.261200Z

Yep, there are two main steps to transforming to a string: 1. Group the stars by character 2. Convert each group into a character Stars that all belong to the same character will have contiguous x-values. (They will also have contiguous y-values, but characters are taller than they are wide, so it's cheaper to group by x. Once the stars are grouped, I made a simple stars -> character hashmap, and reverse-engineered what the stars pattern should be for each character. I only had 7 unique characters in my data set, so I only have 7 of 26 characters in my hashmap. Once I get borkdude's data I'll need to reverse engineer again and add some entries to my hashmap for my solution to work automatically with his input.

2018-12-10T19:50:49.261400Z

2018-12-10T19:52:44.261700Z

Here's my method for grouping by x-position:

(defn left-most-x-neighbor [all-points point]
  (let [x-vals (into #{} (map first all-points))]
    (loop [x (first point)]
      (if (x-vals (dec x))
        (recur (dec x))
        x))))

(defn group-stars [stars] 
  (group-by 
    (partial left-most-x-neighbor stars)
    stars))

2018-12-10T19:55:09.261900Z

This group-by pattern is something I've encountered a couple times now. "Start a group by unconditionally taking the first item in a seq. Continue adding to the group as long as (pred group new-item) is truthy. When it is falsy, start a new group with new-item instead."

2018-12-10T19:56:08.263300Z

Have someone already talked about the trick to pre-calculate the time the letters show up?

2018-12-10T19:56:38.263700Z

@quoll Informed me this morning.

taylor 2018-12-10T19:59:20.264600Z

I think one heuristic is finding the point when the set of points' X/Y coords shrinks then starts growing again

2018-12-10T19:59:51.265500Z

thereā€™s a way to know almost for sure (no heuristic)

taylor 2018-12-10T20:00:15.266400Z

i.e. when the coords are most aligned with each other

quoll 2018-12-10T20:00:19.266600Z

Part 1: 34.33306 msecs Part 2: 8.483958 msecs

2018-12-10T20:00:23.266800Z

even better

2018-12-10T20:00:36.267300Z

answer in thread? @quoll

mattly 2018-12-10T20:00:41.267600Z

ok you've got my curiosity

quoll 2018-12-10T20:00:51.267800Z

my part 2 re-calculates everything, but I figure itā€™s warmed up

quoll 2018-12-10T20:02:01.268900Z

After parsing the file into a seq of lists 4 numbers wide, I start with this:

quoll 2018-12-10T20:02:10.269300Z

(let [[[_ y1 _ y1v] [_ y2 _ y2v]] data
        estimated-t (Math/abs (long (/ (- (Math/abs (- y1 y2)) 10) (- y1v y2v))))

2018-12-10T20:02:17.269700Z

You can take two points with different velocities and do a closed form arithmetic calculation to find the time at which they pass each other in the x- or y-dimension. That will get you close within a few iterations.

2018-12-10T20:02:48.270300Z

The larger the velocity difference, the closer you'll get to the actual time.

quoll 2018-12-10T20:03:17.271Z

you know that the final answer has every y-coordinate within 10 units of each other

mattly 2018-12-10T20:03:25.271300Z

I've been meaning to level up my math

quoll 2018-12-10T20:03:58.272600Z

itā€™s literally year 9 algebra (I know, because my son is in year 9, and Iā€™ve been helping him with inequalities in recent weeks)

mattly 2018-12-10T20:04:00.272700Z

they actually didn't specify the height, only implied it from the example

taylor 2018-12-10T20:04:04.272800Z

why 10 units?

quoll 2018-12-10T20:04:53.274300Z

that is true. In fact, the example was 8 high. I started by using an inequality of 8. It still gave a very good estimate

mattly 2018-12-10T20:05:02.274700Z

I got a C in Algebra 30 years ago

misha 2018-12-10T20:05:18.275300Z

I think it's still a magic number

ā˜ļø 2
quoll 2018-12-10T20:05:22.275500Z

but then I saw that the result was 10 high, so I updated my code to have 10 instead of 8 šŸ˜„

misha 2018-12-10T20:05:56.277300Z

by all means, use it to get yourself higher on a scoreboard, tho. but as soon as we are taking time to optimize for speed, ā€“ it's a magic number

2018-12-10T20:06:02.277700Z

Every example Iā€™ve seen was 10. But, yeah, itā€™s an assumption.

taylor 2018-12-10T20:06:06.277900Z

I think that works perfectly fine for this problem but it's not a general solution (which doesn't matter for AoC but y'know)

mfikes 2018-12-10T20:06:13.278300Z

Then you skip several thousand iterations?

quoll 2018-12-10T20:07:02.278900Z

when the number was 8, my estimate was 10519. When the height is set to 10, the estimate came in at 10510. The final answer for my data was 10511

misha 2018-12-10T20:08:35.280800Z

you can try to optimize against (+ guess-algo-time wrong-answer-timeout) :opieop:

2018-12-10T20:09:07.281900Z

If you want a solution without a magic number, find the time at which two points pass each other in y, then iterate both backwards and forwards in time until you find the minimum y-height. The algorithm will be entirely based on the input data, no magic numbers.

quoll 2018-12-10T20:09:19.282100Z

if I presumed that the height was 1, then the estimate was 10508. So my presumed height really didnā€™t matter

quoll 2018-12-10T20:09:55.283Z

Letters cannot be smaller than 1, so thatā€™s reasonable, and does not include a magic number

1
misha 2018-12-10T20:10:39.284500Z

I think there might be some inputs which would not work, like if text is sideways (since it was probably for human eyes anyways)

2018-12-10T20:11:10.285300Z

@quoll Is there a way you check that the convergence hasn't already passed?

quoll 2018-12-10T20:11:17.285600Z

no, but it would make the estimate come in further away from the final result

misha 2018-12-10T20:11:37.286400Z

but yes, min area, or height, etc - is a very good approach, I think

quoll 2018-12-10T20:12:33.288200Z

I increment the time, and compare the area of the points. If itā€™s larger, then I start going back in time. If itā€™s smaller, then I go forward in time. I keep iterating while the area gets smaller. As soon as it starts to get larger again, Iā€™ve found my minimum area

šŸ§  1
misha 2018-12-10T20:12:52.288900Z

I imagined an input which 1st crosses over itself, and then aligns. that would throw off min-area heuristic a bit

quoll 2018-12-10T20:13:10.289200Z

I tested by pushing my ā€œestimateā€ smaller and larger, and it moves in the correct direction each time

misha 2018-12-10T20:13:37.290Z

I mean 5 4 3 2 1 2 3 result instead of 5 4 3 2 1 result

mattly 2018-12-10T20:13:54.290600Z

fortunately they didn't throw that at us

misha 2018-12-10T20:14:05.291Z

true )

quoll 2018-12-10T20:14:05.291100Z

@misha I did consider that itā€™s possible for it to have a minimum area that wasnā€™t the solution.

quoll 2018-12-10T20:14:28.291900Z

But I cheated, and ran through the renderings by hand before I automated it šŸ˜œ

ā˜ļø 1
misha 2018-12-10T20:14:35.292100Z

I did (consider) too, but when I saw an accepted answer I just chilled :kappa:

misha 2018-12-10T20:15:08.292700Z

but my rendering is sideways :D

quoll 2018-12-10T20:16:11.293800Z

Itā€™s also possible (though unlikely with integer velocities) to have every point occupy a single point at some time

misha 2018-12-10T20:17:20.294600Z

I put points count asserts in each frame, but did not commit it into git eventually

quoll 2018-12-10T20:18:07.295Z

To be honestā€¦. I got my initial estimate by hand

šŸ‘ 1
quoll 2018-12-10T20:21:05.298Z

when I went to bed last night, the puzzle had been published, so I looked it up, then put my phone down and tried to sleep. But then I started thinking about how the final rendering must have all the y-coordinates within a small range (was it just one line? Multiple lines?). Anyway, it was too much for me, and pulled my phone back out, grabbed a couple of numbers from my input, and did the algebra. That gave me the number 10519. Thatā€™s the number I started with this morning. And my answer was at 10511

quoll 2018-12-10T20:21:31.298400Z

I do like it when you can shortcut a whole lot of the work with a little bit of math

šŸ‘ 1
quoll 2018-12-10T20:22:14.299200Z

it makes me feel smart :female-student:šŸ¤Ŗ

mattly 2018-12-10T20:22:30.299600Z

that's one of the fun things about these puzzles, is how flexible you can be at arriving at the solution

mattly 2018-12-10T20:23:00.300400Z

and it's fun watching the different approaches people take to get there

Average-user 2018-12-10T20:24:13.301700Z

I did https://adventofcode.com/2017/day/7 (part1) with the searching feature (ctrl+f) of chrome in a couple of seconds. Sadly I was doing it the day after so I didn't get in the leaderboard

genmeblog 2018-12-10T20:26:31.303100Z

My estimate is like that (long (* 0.99 (/ extent vextent)))

genmeblog 2018-12-10T20:26:53.303800Z

where extent is maximum absolute coordinate value and vextent same for speed

quoll 2018-12-10T20:38:46.311100Z

oh, someone just reminded me of another approach that I considered, but am glad I didnā€™t spend time onā€¦ The roman alphabet has lots of vertical lines (my solution has 16 vertical lines of length 3 or greater. 4x length 3, 1x length 4, 1x length 5, 1x length 8, 9x length 10). My other way of looking was to look for vertical lines in the rendered field. However, unlike the ā€œminimum areaā€ approach, it wouldnā€™t tell me if I was going in the right direction when I went forward to backward in time. (Not a huge deal, given the accuracy of estimating the time). Luckily, while looking at the various renderings, I saw the area converging to the minimum, so I didnā€™t waste time on that

taylor 2018-12-10T21:13:29.312800Z

am I remembering correctly last year there was a problem that was possible to solve by equation, but the most obvious solution was simulation

quoll 2018-12-10T21:14:14.313Z

this sounds familiar

quoll 2018-12-10T21:15:08.314100Z

day 22 was a simulation of a processor with a small instruction set, which was solved by simulation

quoll 2018-12-10T21:16:37.315200Z

day 23 used the same instruction set, but multiplied 2 large numbers with the multiplication algorithm of:

a*b => if b = 1: a
       else: a + a*(b-1)
and
a+b => if b = 0: a
       else: (a+1) + (b-1)

quoll 2018-12-10T21:17:21.316300Z

I think that was it. Anyway, it just needed you to multiply the numbers. But you had to decode what it was doing before you knew that was what you were attempting

quoll 2018-12-10T21:18:01.317200Z

simulating it was going to take years

taylor 2018-12-10T21:18:13.317500Z

yeah I'm looking at my solution for that and remembering having to essentially turn the assembler instructions into C-style code so I could write equivalent Clojure before refactoring it https://github.com/taylorwood/advent-of-code/blob/master/src/advent_of_code/2017/23.clj

Average-user 2018-12-10T21:22:17.318400Z

have you done year 2016?

taylor 2018-12-10T21:26:25.318500Z

looks like I only did the first few days

2018-12-10T21:41:02.319900Z

I looked at my input numbers, and noticed that all the ones around with coords at 50000 had velocities at -5, and so on for 40000, -4 and 30000, -3 etc.

2018-12-10T21:41:23.320400Z

So I fast forwarded to 10000 seconds and ran the visualization from there.

mfikes 2018-12-10T21:43:21.321Z

Yeah, it also appears that all of our answers are 10,000 + n where n is in the range of a few hundred

mfikes 2018-12-10T23:02:10.325400Z

If you are solving these problems in ClojureScript (and in particularly via Advent of CLJC), there are a couple of new utilities, nthā€™ and countā€™ that you might find useful for lack of locals clearing. This makes a difference of 200 MB vs 3 GB for todayā€™s solution (at least in the way I did it.)

2018-12-10T23:39:31.326400Z

Someone is compiling layout of known characters for d10. Useful if you want to do programmatic identification of your message. https://www.reddit.com/r/adventofcode/comments/a4tbfl/trying_to_collect_all_used_letters_for_character/ https://gist.github.com/usbpc/5fa0be48ad7b4b0594b3b8b029bc47b4

benoit 2018-12-10T23:53:08.326900Z

šŸ™‚