That was refreshingly fun after yesterday
Nice, relaxing one.
really frustrating for me 😕 sample input works, real input fails
gah finally got it after finding all my dumb bugs. felt like I wrote way too much code for this one
are there any people doing Advent of CLJC and using Windows?
Yeah i did my last solution from a windows machine
@mrmcc3 does tools.deps work fine for you on Windows?
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
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
@mrmcc3 would it be reasonable to assume just about every developer on Windows uses WSL?
Ha no idea I only just started trying on AOC
I’m glad to hear the scripts work in WSL 😉
I wonder if Planck works under WSL
I can try it out don't see why not
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.
My solution for Day 13 https://github.com/benfle/advent-of-code-2018/blob/master/day13.clj
@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
@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
but good to know it’s an option
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
I might make a script that does this automatically per day
I just read day 13, seems fun. But I don't know if I'll have time to implement it today
I'm too ashamed to commit my solution :biohazard_sign:
@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
@helios I think you’re replying to something that was a reply to that lib 😉
whoops 😛 it happens when they are discussions of days ago 😄 sry!
I'm getting an "incorrect answer" on day13 part 2
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
Here's my attempt: https://github.com/pesterhazy/advent2018/blob/master/src/advent/puzzle13.clj#L120
that is the worst feeling
Haven't encountered that in any previous day
That's cheating ;)
Found the bug - now it works https://github.com/pesterhazy/advent2018/blob/master/src/advent/puzzle13.clj#L78
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
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
I wonder what conclusions to draw from this, other than the fact that I'm dense 🙂
cool!
debugging is part of the process 😉
is this live btw?
@me1740 always look on the bright side...
Yeah when I post it’s live.
VODs are available for 14 days
sounds fun, this was my first Twitch experience
VOD?
i thought it was only for games!!
Video On Demand
sry gamer term 😛
Yeah, no. Twitch is pretty great actually.
I’m not a gamer, sorry 🙂 why not post these to Youtube then?
btw, very cool and inspiring. can’t wait to hack something mutable now in Clojure 😛
Uhh, so I’m thinking about posting to youtube or self-hosting
haven’t decided yet
Thanks for the feedback! It’s much appreciated!
cool. valuable tutorial. I think I might try day 9b in the Christmas break.
I first saw this mutable approach here. Very similar solution I think: https://github.com/kolov/adventofcode2018/blob/master/day9-marbles/src/main/scala/example/Main.scala
case class Marble(var left: Marble, var right: Marble, value: Int)
I honestly don’t know how to do it efficiently w/o mutability. I’m sure there’s plenty of higher polynomial solutions.
These dequeue data structures do exactly this? I didn’t look into those
I tried it with plain vectors first. it works, but sloooow
Almost. You have to build a rotation fn in. But they’re structured so this operation is pretty efficient.
Yeah, I saw immediately that was an issue. Went off and thought about it for a while before starting.
Then come to find out java has a much better solution built-in 😛
yeah, but advent of cljc has to work on Node as well 🙂
maybe node also has something like this, but may require a lib
your solution probably works out of the box
I went with an imperative solution b/c it seemed most straightforward late at night
It's not too bad w/ pure functional code, either; I usually end up with tagged results, e.g. [:ok carts]
or [:collided colls]
Not much different than using reduced
Was fun. Thanks a lot!
This day was a big piece of work. Not hard. Just tiring and long. But fun 😄 Finally something that even I can manage
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.
A "concise" solution for day12: https://www.reddit.com/r/adventofcode/comments/a5eztl/2018_day_12_solutions/ebmfcqc/
With java you can work with 'native' intarrays and get the solution down to 33 ms.
Wouldn't surprise me if there was an even faster way to calculate it using some mathematical model.
Figures... i struggle for hours, post, and 30 min later find the bug
Ahhh, APL; ever a source of delight and horror. To be fair, it's probably a fantastic fit for a number of these problems.
@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.
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.
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.
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.
That’s what I did - set a flag and clean up in a second pass
I might give that a shot, much cleaner than the index fiddling I'm doing.