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
euccastro 2020-12-24T00:47:30.122200Z

yes, I tried an "optimization" in my 33 minute solution that took it to 45 πŸ˜›

euccastro 2020-12-24T00:49:45.123Z

@misha there's aset-int too; I got no reflection warnings when using that and no type hints a single type hint on the array itself

misha 2020-12-24T11:38:32.139400Z

Yeah, I saw it in your code, TIL :opieop:

euccastro 2020-12-24T05:59:30.124400Z

I lucked out on this one, since I'd worked with hex grids a while ago: https://wiki.call-cc.org/eggref/4/hexgrid [P.S.; NB I'm not using that coord system here, but a simpler one with y pointing northwest and x pointing east.]

βž• 1
2020-12-24T06:05:20.125Z

I was a game programmer, so I know my bestagon :-)

1
❀️ 2
πŸ•ΈοΈ 2
2020-12-24T06:06:13.125700Z

Good morning. Today, a video about the bestagons. https://www.youtube.com/watch?v=thOifuHs6eY

🐝 4
❀️ 3
πŸ™ 2
πŸ•ΈοΈ 1
2020-12-24T06:07:12.126Z

I wasted 20 minutes on >= 2 vs > 2 :picard-facepalm:

1
2020-12-24T06:08:23.126300Z

@zelark I was thinking about you when I saw that it was once again about neighbors.

😁 1
euccastro 2020-12-24T06:11:05.126700Z

I missed this first initially so my solution2 was running forever and I got really scared that there was some combinatorial madness going on again πŸ˜„ https://github.com/euccastro/advent-of-code-2020/blob/9e9cabf2fcd8ea8383ec193696ec9ebdb81be400/src/advent/day24.clj#L84

markw 2020-12-24T06:11:22.127100Z

a bit confused on the instructions for part 2

markw 2020-12-24T06:11:36.127500Z

are we supposed to use the colors determined from part 1 as the starting point?

2020-12-24T06:12:01.127800Z

@markw Yes

☝️ 1
markw 2020-12-24T06:12:18.128100Z

ok good to know πŸ™‚

rjray 2020-12-24T06:14:37.128500Z

Thanks to what I learned on day 17 from @zelark's code (and for the fact that I have been taking notes each day), part 2 went faster than part 1. https://github.com/rjray/advent-2020-clojure/blob/master/src/advent_of_code/day24.clj

πŸ‘ 4
😁 1
βž• 1
2020-12-24T06:19:39.129Z

And here is mine πŸ™‚ https://github.com/zelark/AoC-2020/blob/master/src/zelark/aoc_2020/day_24.clj

βœ”οΈ 1
πŸŽ‰ 3
2020-12-24T06:27:03.130Z

As expected, frequencies was frequently used.

2020-12-24T06:33:28.130200Z

just leave it here ^_^

(defn stepper [neighbours birth? survive?]
  (fn [cells]
    (set (for [[loc n] (frequencies (mapcat neighbours cells))
               :when (if (cells loc) (survive? n) (birth? n))]
           loc))))

(stepper neighbours #{2} #{1 2})

😍 2
euccastro 2020-12-24T06:34:01.130500Z

description of the coordinate system @vincent.cantin and me used: https://www.redblobgames.com/grids/hexagons/#coordinates-axial

πŸ‘ 4
😏 1
euccastro 2020-12-24T06:35:43.131400Z

only our y points northwest

euccastro 2020-12-24T06:45:20.132300Z

@vincent.cantin @zelark nice touch on using re-seq to parse the line. I'll borrow that to remove my silly str/replaces πŸ˜„

euccastro 2020-12-24T06:46:04.132500Z

I guess I wasn't sure enough that re-seq would do the right (greedy) thing..

2020-12-24T06:46:27.132800Z

> β€œThere is a REPL for that”

euccastro 2020-12-24T06:46:50.133Z

true true...

euccastro 2020-12-24T06:53:21.133200Z

somehow that makes my code a bit slower... but I'll keep it anyway since it reads much better

nbardiuk 2020-12-24T07:56:49.133500Z

after revisiting the redblobgames article and choosing right coordinate system it was easy https://github.com/nbardiuk/adventofcode/blob/master/2020/src/day24.clj

πŸŽ‰ 4
2020-12-24T13:54:06.141600Z

Anyone wants to check it? :)))

2020-12-24T14:11:02.142500Z

Above 1 million iterations, it's called Crab-coin.

πŸ˜† 1
2020-12-24T16:01:23.143900Z

Bestagons found...

2020-12-24T16:01:27.144Z

6
🎯 1
rjray 2020-12-24T17:50:27.146Z

I'm just crossing my fingers that we don't get another Zork like last year's day 25...

2020-12-24T18:43:02.147500Z

I was too lazy and relaxed to write an algorithm for that, so just I played in it as it was a game, and got my 2 stars in the end.

2020-12-24T19:36:47.148100Z

For tomorrow’s puzzle, I randomly predict a path finding problem.

rjray 2020-12-24T20:58:41.148200Z

Same. I used math.combinatorics to generate the sets of items to hold at once. According to last year’s notes, this got me a ranking of 635 on part 1.

rjray 2020-12-24T21:01:42.149Z

I would welcome that. I have plenty of prior art that I can (try to) adapt for that.