Advent of Code 2021

For any other OCamlers having a go at Advent of Code this year, I thought I’d create this thread for discussing/sharing/comparing.

I doubt I’ll see it all the way through myself, but will keep at it until I run out of steam :slight_smile:

If anyone would like to form an ocamlcentric leaderboard, all may feel free to use my private leaderboard, by entering code 221063-e41acad3 at Leaderboard - Advent of Code 2021 (after logging in). I’d also be happy to join a different leaderboard if there’s already one fit for this purpose :slight_smile:

(Discussion from a few years back is here: Advent of Code starts today)

10 Likes

I’ve already fallen a bit behind, so I’m not sure how long I’ll keep at it either, but I’ll join! Here are my solutions so far.

For Day 3 I also decided to try to see how close I could get to the top 100, so I did my first solution in the browser console and got it in about 6 minutes, which got me about 1000th place I think, so I gave up on that idea :sweat_smile:

1 Like

This year I’m using Rust and not OCaml (I know OCaml too well, and I treat AoC as an opportunity to learn new things).

1 Like

I had been referring to your old leaderboard, from your post in 2017, as a motivator, but decided to create this thread after I got booted from it :stuck_out_tongue_winking_eye: I hope your Rusting in going swell! :crab:

Last year I tried to do the solutions in Lambda Prolog, with the aim of learning new things. I did learn a lot, but I also found that I am generally so slow at solving the puzzles that the added challenge of a new (research-grade) language made it impossible for me to keep up. The main thing I aim to learn this year is how to dispatch the puzzles more quickly! So my ambition is to solve the puzzles in little enough time that I can sustain engagement throughout the whole calendar. We’ll see how that goes :camel:

Congrats on making it into the top 1000th! :tada: Even if my bedtime weren’t well before midnight EST, I still don’t think I’d have a prayer of solving a puzzle quickly enough for that :slight_smile: I’ve enjoyed looking over your solutions, thank you for sharing!

My solutions are going into GitHub - shonfeder/aoc2021: AOC 2021 in OCaml 🐫 . I’m currently trying to focus on improving my ability to focus and avoid getting lost down rabbit holes or caught up in trivial mistakes that slowdown my time to solution. To that end, I’ve started keeping some notes to reflect on the mistakes I’m making.

3 Likes

There are people doing speed runs who finished both parts of day 1 in under 90 seconds. I think one’s best policy, unless one is determined to set up specifically to do speed runs, is to accept that one is not going to be high on the leaderboard. :slight_smile:

I was cleaning it out to have a new set of people using it this year. I didn’t realize anyone from 2017 was still using it. :slight_smile:

1 Like

I don’t work in OCaml day to day (booooo), so every time I punch in a nice pure |> pipeline for a solution, I still get that sweet, sweet FP rush

4 Likes

One of the learnings I’m hoping to glean from this year’s puzzles is to improve my ability to analyze, “formalize”, and implement specifications. So I’m spending some time each day refining the puzzle descriptions into more systematic specifications. Today I noticed an inconsistency in the puzzle description :slight_smile:

The energy level of each octopus is a value between 0 and 9 .

any octopus with an energy level greater than 9 flashes

If the first line holds, then no octopus could flash! :boom: :octopus::bulb:

So it’s over! Looks like two of us finished!

2 Likes

Anyone else doing AoC 2022?

I’m on day 4.

1 Like

I’m doing AoC 2022! using OCaml w/Core & Base and as of right now: no complaints!

1 Like

I just used Base’s List.chunk func. So helpful.

1 Like

I’ve done a couple using Eio, the Eio.Path.with_lines function has been super useful. Might find some use for its built-in parser combinator too in coming days.

1 Like

That’s helpful. I had tried to pretend I was dealing with a large file and use streams, but I gave that up quickly. :laughing:

I am also doing Advent of Code 2022 but so far I haven’t used any libraries other than Stdlib. I try to minimize the submission time.
https://github.com/kodwx/advent-of-code

3 Likes