Fork me on GitHub
#adventofcode
<
2018-12-13
>
norman06:12:51

That was refreshingly fun after yesterday

fellshard06:12:50

Nice, relaxing one.

taylor06:12:53

really frustrating for me 😕 sample input works, real input fails

taylor07:12:09

gah finally got it after finding all my dumb bugs. felt like I wrote way too much code for this one

borkdude07:12:46

are there any people doing Advent of CLJC and using Windows?

mrmcc307:12:25

Yeah i did my last solution from a windows machine

borkdude07:12:16

@mrmcc3 does tools.deps work fine for you on Windows?

borkdude07:12:43

I’m considering using Planck or Lumo for scripting instead of bash, but I’m wondering if this would be problematic for some people. It’s not strictly necessary

mrmcc308:12:24

Ah i just use the tools.deps built into cursive/intellij. Once I solved the problem in clojure from the repl I run the scripts in WSL ubuntu

borkdude08:12:10

@mrmcc3 would it be reasonable to assume just about every developer on Windows uses WSL?

mrmcc308:12:04

Ha no idea I only just started trying on AOC

borkdude08:12:37

I’m glad to hear the scripts work in WSL 😉

borkdude08:12:50

I wonder if Planck works under WSL

mrmcc308:12:48

I can try it out don't see why not

magic_bloat12:12:10

day 13, quite fiddly - I had a bug that had trains going completely the wrong way at the junctions, but cleverly and annoyingly it managed to get the right answer on the test input.

mfikes12:12:11

@borkdude Planck does work under WSL. There is an upstream WebKit issue that has a workaround (not sure if that issue has been fixed and the fix widely deployed; I haven't looked at it in a while). https://github.com/planck-repl/planck/issues/746

borkdude12:12:50

@mfikes cool! I haven’t made my mind up about it yet, since I think most of the stuff works, but it would be more maintainer friendly if some bash was replaced with clojure. on the other hand, I’m forcing an extra installation step on advent-of-cljc users

borkdude12:12:26

but good to know it’s an option

borkdude13:12:20

btw, if you want to trigger recording of the scores for certain days, all you have to do now is create a PR to a branch named yyyy/dd/rescore, then I’ll accept it, and all the changed namespaces will be recorded. I did that here: https://github.com/borkdude/advent-of-cljc/tree/2018/01/rescore these changes won’t have to be applied to master, just being in a branch in my repo is enough

borkdude13:12:41

I might make a script that does this automatically per day

Average-user16:12:24

I just read day 13, seems fun. But I don't know if I'll have time to implement it today

taylor17:12:38

I'm too ashamed to commit my solution :biohazard_sign:

helios17:12:34

@borkdude replying to something of a few days ago: https://github.com/lambdaisland/trikl a new project to make terminal UIs in clojure. It might be good for some of the visualizations of the AoC

borkdude17:12:56

@helios I think you’re replying to something that was a reply to that lib 😉

helios17:12:02

whoops 😛 it happens when they are discussions of days ago 😄 sry!

pesterhazy17:12:01

I'm getting an "incorrect answer" on day13 part 2

pesterhazy17:12:42

But I'm not sure it's incorrect or how it could be wrong - it works on part 1 and on the extra sample input provided for part 2

ccann17:12:35

that is the worst feeling

pesterhazy17:12:02

Haven't encountered that in any previous day

gklijs18:12:58

That's cheating ;)

borkdude18:12:55

is this live btw?

potetm19:12:55

Yeah when I post it’s live.

potetm19:12:02

VODs are available for 14 days

pesterhazy19:12:19

sounds fun, this was my first Twitch experience

pesterhazy19:12:29

i thought it was only for games!!

potetm19:12:48

Video On Demand

potetm19:12:53

sry gamer term 😛

potetm19:12:03

Yeah, no. Twitch is pretty great actually.

borkdude19:12:07

I’m not a gamer, sorry 🙂 why not post these to Youtube then?

1
1️⃣ 1
borkdude19:12:31

btw, very cool and inspiring. can’t wait to hack something mutable now in Clojure 😛

potetm19:12:53

Uhh, so I’m thinking about posting to youtube or self-hosting

potetm19:12:57

haven’t decided yet

potetm19:12:07

Thanks for the feedback! It’s much appreciated!

borkdude19:12:26

cool. valuable tutorial. I think I might try day 9b in the Christmas break.

borkdude19:12:40

case class Marble(var left: Marble, var right: Marble, value: Int)

potetm19:12:23

I honestly don’t know how to do it efficiently w/o mutability. I’m sure there’s plenty of higher polynomial solutions.

borkdude19:12:45

These dequeue data structures do exactly this? I didn’t look into those

borkdude19:12:08

I tried it with plain vectors first. it works, but sloooow

potetm19:12:14

Almost. You have to build a rotation fn in. But they’re structured so this operation is pretty efficient.

potetm19:12:45

Yeah, I saw immediately that was an issue. Went off and thought about it for a while before starting.

potetm19:12:02

Then come to find out java has a much better solution built-in 😛

borkdude19:12:27

yeah, but advent of cljc has to work on Node as well 🙂

borkdude19:12:37

maybe node also has something like this, but may require a lib

borkdude19:12:55

your solution probably works out of the box

meikemertsch19:12:15

Was fun. Thanks a lot!

gklijs20:12:42

With java you can work with 'native' intarrays and get the solution down to 33 ms.

gklijs20:12:56

Wouldn't surprise me if there was an even faster way to calculate it using some mathematical model.

pesterhazy18:12:49

It's not that the puzzle description was unclear - but I still failed to grasp the rules for collision detection. Somehow I feel an imperative solution would have been more obvious

pesterhazy18:12:08

I made multiple mistakes of conception when choosing the pairs for collision comparison - which sadly worked for p1 but gave an incorrect answer for p2

pesterhazy18:12:40

I wonder what conclusions to draw from this, other than the fact that I'm dense 🙂

benoit18:12:58

debugging is part of the process 😉

pesterhazy19:12:51

@me1740 always look on the bright side...

taylor19:12:32

I went with an imperative solution b/c it seemed most straightforward late at night

fellshard19:12:31

It's not too bad w/ pure functional code, either; I usually end up with tagged results, e.g. [:ok carts] or [:collided colls]

fellshard19:12:48

Not much different than using reduced

meikemertsch19:12:03

This day was a big piece of work. Not hard. Just tiring and long. But fun 😄 Finally something that even I can manage

markw20:12:43

I've burned too much time on this problem... this code works on the sample input and a few others I created but chokes on the actual input - I can't find the bug.

fellshard20:12:50

Ahhh, APL; ever a source of delight and horror. To be fair, it's probably a fantastic fit for a number of these problems.

markw20:12:57

Figures... i struggle for hours, post, and 30 min later find the bug

magic_bloat21:12:54

@pesterhazy Had the exact same problem - it worked for the example, but took three attempts at getting the collision detection exactly as described to make it work for the actual puzzle.

fellshard22:12:59

It made the recursion annoying, because you really can't solely update carts in-place, since each cart depends on the result of the cart before it. I ended up using straight loop-recur over reduce this time because of that.

benoit22:12:01

Yes, that was my main bug too. A cart might have disappeared because of a collision. I solved it by checking that the cart was still around before trying to move it. So I could continue to reduce.

fellshard23:12:53

You know, you're right. Could've done it by just flagging the collided carts instead of removing them. Would've made some things easier.

pesterhazy23:12:09

That’s what I did - set a flag and clean up in a second pass

fellshard23:12:05

I might give that a shot, much cleaner than the index fiddling I'm doing.