With Day 1 in the books, hopefully you’re starting to get into the swing of things. I know that I definitely didn’t spend a few hours fiddling with my AoC tooling yesterday. That would be obsessive and overkill. 😐
The Puzzle
Today’s puzzle involves passwords and security policies. Each listing has a password alongside the security policy in place for it, but some passwords aren’t compliant! It’s our job to analyze the passwords and sort things out.
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:05PM 12/12/2020 PST.
Language | Count |
---|---|
Python | 5 |
C | 2 |
Rust | 2 |
JavaScript | 2 |
C# | 1 |
Raku | 1 |
PHP | 1 |
Scratch | 1 |
Elixir | 1 |
Haskell | 1 |
COBOL | 1 |
Ruby | 1 |
Merry Coding!
Oldest comments (24)
Hi guys!
The second day was awesome. I've really enjoyed the task. :) I'm still learning Elixir, but I think my solution was not that bad. :) Of course, I did it in Elixir.
This time I've split the day into two modules - one per part. The full solution is on my GitHub repository.
The first part of the day looks like:
The second part of the day looks like:
Rust solution for Day 2. Felt happy and clever at the inclusion of the XOR for part 2.
Full repo on Github.
Rust looks intriguing! I hope that one day I will find time to learn this language. :D
Ooh boy it's a little early in the season to already be stumped by an off-by-one bug. 1-BASED INDICES RYAN! 1-BASED! IT'S RIGHT THERE IN THE PROMPT!
Also, I started a little parsing module to help me with some of the repetitive tedia.
Day2.h:
Day2.c:
parsing.h:
parsing.c:
Also a little tooling to help generate the daily files:
bin/newday:
Hey Y'all!! This time, I actually brought the input.txt file in as it was, and again, made a ruby solution that im sure could be a bit more refactored, but i got to play with regex! so that was fun...
Here's my full code, and here's a snippet of what i did to solve it:
Late for the party, as always, but here's a few words about yesterday's challenge:
Solving AoC#2 puzzle with Parslet
Paweł Świątkowski ・ Dec 3 ・ 4 min read
COBOL (second one is on my GitHub):
IMO you’re a real hipster using Cobol! Great job! :)
Thanks! Gotta stay busy in the pandemic somehow. :)
May I ask you - have you used Cobol before? Or it's just your pandemic-advent challenge? :D
I started in the spring and wrote a couple things like FizzBuzz: github.com/GaloisGirl/Coding/tree/...
Then I had a bit of a life, and now I'm having a second wave of COBOL.
My Rust solution for Day 2. Also using an XOR :). Great minds think alike.
Using AoC to brush up my Rust this year.
I adapted Bodil's parser combinators into a little parser module, as I suspect there'll be much more parsing to come.
And then the solution is:
What I came up with in Ruby:
And for comparison, here is the inlined version:
Mine!
Hi,
For this 2nd day, I want to play a little with regexp :) . Code In PHP
Full size here : Advent of Code - Day 2
I can't remember the last time I had a genuine use for XOR in my day job!
Javascript solution:
Here's my solution in Python
My JavaScript walkthrough: