Fork me on GitHub
<
2016-12-14
>
raspygold02:12:53

👋 I’m really enjoying AoC this year. I only solved about half the problems last year before I got too busy, but this year I’m hoping to solve them all. By default I'm solving them in Ruby, but I’ve started learning Clojure this year so hoping to solve them all with Clojure afterwards. Day 11 had me stumped for a good while!

fellshard02:12:56

I've had to fall off the bandwagon; brother's wedding is coming up, so I've already fallen behind a couple days, and it'll only be more over the next week, hah.

dexter09:12:23

Same here, I'm still on day 8, although i'm a bit stuck and I've got no idea what I've done wrong. The sample they give seems to work when I used reductions to spot check the translations around the edge cases and it all seemed to work, it happily wraps round with no issues etc. Short of actually manually doing the transformations one by one I'm a bit stuck. If anyone's feeling generous and got any tips I'd appreciate some advice on where to look https://github.com/feldoh/advent-2016/blob/day8/src/advent_2016/day8.clj

cjmurphy09:12:24

@dexter: The approach I took was to just have one function that could turn a particular [x y] 'pixel' on or off. Then in terms of that operation you can do the rotations. That way the same code is used for either a row or column rotation.

dexter10:12:52

@cjmurphy I've done something relatively similar but I used rotating a row as my basic operation wherein I transpose -> rot row -> transpose if it's a column. To rotate a row I used cycle to build a view over that row which I reverse then just drop the first n off. I can just start over but I'd love to know what I'm missing with the solution I've got. Given that I've clearly missed an edge case that my tests aren't catching it seems likely if I start over with a new approach I'll miss the same edge case again.

cjmurphy11:12:27

Transposing then dropping off does sound tricky. I looked at your code but hard for me to see anything wrong. One thing that can help (and will help you with a later day/s), and might be better/easier than tests, is to have an actual visual representation, so like `\.` and `'\#` instead of `:off` `:on`, which won't line up nicely in a rectangle.

dexter11:12:24

I've got a messy local copy where I was just trying that actually 😛

dexter11:12:33

I drew it with quil

dexter11:12:02

hmm, i'll try ascii art

dexter11:12:22

its got pixels everywhere

cjmurphy11:12:20

You can do it with the data structure itself. See `visual-validation` here: https://github.com/chrismurrph/advent-of-code/blob/master/dev/server/advent/thirteen.clj

cjmurphy11:12:39

`pprint` seems to understand what 'all lined up properly' means, as far as having a \n at the end of every row.

thegeez11:12:35

@dexter for day8 your solution and mine differ from input line 29 "rotate column x=32 by 1"

thegeez11:12:36

and as a shameless plug: using clojure.spec to parse instructions might help: http://thegeez.net/2016/12/09/parsing_clojure_spec_advent_of_code.html

dexter15:12:24

interestingly it seems to be mutating rows other than the one I'm changing which is really bizzare, ah well at least I have something to investigate. thanks for the pointers guys

bhauman17:12:49

day 11 was a bear, but you can reduce the computational complexity immensely, hit me up if you have questions

mnespor17:12:48

Your representation of the generators and chips is very, very cool

bhauman20:12:23

@mnespor thanks 🙂 getting the next states from it is harder but it reduces the number of next states dramatically