This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-21
Channels
- # adventofcode (82)
- # bangalore-clj (1)
- # beginners (44)
- # boot (7)
- # boot-dev (25)
- # cider (1)
- # cljs-dev (3)
- # cljsrn (14)
- # clojars (11)
- # clojure (210)
- # clojure-dusseldorf (4)
- # clojure-gamedev (2)
- # clojure-greece (11)
- # clojure-italy (6)
- # clojure-norway (6)
- # clojure-russia (6)
- # clojure-serbia (2)
- # clojure-spec (43)
- # clojure-sweden (1)
- # clojure-uk (77)
- # clojurescript (43)
- # cursive (1)
- # data-science (3)
- # datomic (32)
- # duct (3)
- # figwheel (2)
- # fulcro (71)
- # graphql (3)
- # hoplon (14)
- # jobs-discuss (3)
- # lambdaisland (1)
- # leiningen (2)
- # luminus (2)
- # lumo (14)
- # off-topic (16)
- # om-next (1)
- # perun (5)
- # random (1)
- # re-frame (19)
- # reagent (37)
- # ring-swagger (3)
- # shadow-cljs (157)
- # specter (6)
- # sql (29)
- # unrepl (14)
https://github.com/bhauman/advent-of-clojure-2016/blob/master/src/advent_of_clojure_2017/day21.clj
I’m still in progress, so not looking, but I’ve already used flattened. I thought I could avoid assembling the whole grid from the parts, but then realized 3x4 is divisble by 2, sigh… 🙂
@ihabunek just a tip. for
is pretty darn powerful for comprehensions you can do (for [x (range 10) y (range x)] [x y])
Day 21: https://github.com/mfikes/advent-of-code/blob/master/src/advent_2017/day_21.cljc
I definitely really like how you are composing everything into one big transducer function
Yeah, I don't think I succeeded completely. Or, at least I can say, Planck still consumes a few GB when solving it.
Dunno if this is just lazy cleanup of garbage or if it is true head-holding type stuff.
I’m curious if there is any self-referential pattern for part 2 that would allow you to avoid brute force. (I haven’t bothered to check.)
there's this https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drk8j2m/
because we don't have to transform back to the original and if done right we could memoize whole portions of the tree
the recursive solution has to bridge past the divisible by 2 divisible by 3 ambiguity
I tried an answer that I seriously computed, but then it said: this is the answer for someone else. LOL
but one bug I had: I didn’t consider ordering of the rules. Obviously that’s important
DOH, I thought for rotate, rotating the outer nodes of the square around the center one.. what was I thinking, looool
ok well I thought it was my mistake that there would be some rotation literally in the rule book and I would be overriding it
just make sure your (count (distinct (vals rules))
is equal to the original rulles length
yeah, added an assertion for that. I’m using more assertions since you helped me out 🙂
My assumption was that the rules could not be orthogonal with respect to rotations. E.g. if there would be a rule A => that had rotations A’, A’‘, but there would also be a rule B => , with B equal to A’ sorting the rules like A, B, A’ would mess things up
My code. Nothing fancy, but glad it works now. https://github.com/borkdude/aoc2017/blob/master/src/day21.clj