We're on to Day 3 now! I'm seeing a bunch of cool languages getting submitted, which is really fun. Let's get to the puzzle!
The Puzzle
In today’s puzzle, we're trying to toboggan down a foresty slope to get to the coast for our trip. But trees aren't conducive to safe sledding, so we're checking our options carefully before starting. 2-D grids are a staple of Advent of Codeses past, and we've seen things dealing with rational slopes too. But it'll be interesting seeing how you decide to sled down these particular rational slopes. 😉
The Leaderboards
As always, this is the spot where I’ll plug any leaderboard codes shared from the community.
Ryan's Leaderboard: 224198-25048a19
If you want to generate your own leaderboard and signal boost it a little bit, send it to me either in a DEV message or in a comment on one of these posts and I'll add it to the list above.
Yesterday’s Languages
Updated 03:06PM 12/12/2020 PST.
| Language | Count |
|---|---|
| Python | 5 |
| Ruby | 3 |
| Rust | 3 |
| JavaScript | 2 |
| Raku | 1 |
| COBOL | 1 |
| PHP | 1 |
| Elixir | 1 |
| C | 1 |
Merry Coding!
Top comments (39)
Rust again
Rustaceans gonna stick together 🦀:
As always, also available on Github.
The
enumimplementation for your input is cool; I wouldn't have thought of that.Rust using lots of iterators and generators. I'm trying to learn the standard library properly now.
Nice! Didn't know about
product(); will have to keep that in a pocket.I like that your solution allows for an arbitrary starting point, rather than always just (0,0).
One thing I've learned about AoC - try not to bake in any assumptions in part 1!
Maybe this'll be our repeating problem (like the opcodes last year)... Different starting points, different types of obstacles in the snow, terrain to avoid, ...
A bit of Go
First time I've done Advent of Code, but here is my Haskell soloution for Day 3:
Still going strong with COBOL
There is my solution, Elixir as always. I'll switch to Golang/PHP when I get stuck.
Day 3, part 1:
Day 3 part 2:
What's your experience guys? Better to keep both parts in one class/module / whatever?
I typically keep them in the same file in different functions, since work from part 1 is often shared to part 2, (like today), but every so often, he throws a curveball and part 2 ends up being a total rethink, and then it may be nicer to have more separation. It probably doesn’t matter a ton :)
Short Python solution
Hi,
In PHP again, for fun, I try to have the minimum of temporary variables.
Full size here : Advent Of Code - Day 3
Here is my Day 3 in Ruby
Mine!