r/adventofcode • • Dec 02 '20

SOLUTION MEGATHREAD -🎄- 2020 Day 02 Solutions -🎄-

--- Day 2: Password Philosophy ---


Advent of Code 2020: Gettin' Crafty With It


Post your solution in this megathread. Include what language(s) your solution uses! If you need a refresher, the full posting rules are detailed in the wiki under How Do The Daily Megathreads Work?.

Reminder: Top-level posts in Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.

EDIT: Global leaderboard gold cap reached at 00:02:31, megathread unlocked!

99 Upvotes

1.2k comments sorted by

View all comments

2

u/pietroppeter Dec 02 '20 edited Dec 02 '20

🎄👑 Nim

here is my solution in Nim for Day02: https://pietroppeter.github.io/adventofnim/2020/day02.html

I have started using a AoC-styled template (might end up submitting for getting crafty): https://pietroppeter.github.io/adventofnim/index.html

this is in turn based on 🐳 nimib my (few days older) library to publish jupyter-like notebooks in nim: https://github.com/pietroppeter/nimib

Edit: ah, something worth remarking (I use it often in AoC) that I like a lot being in nim and I have not seen it around in other languages (not that I looked into) is the stdlib module strscans which is a very cool way to avoid learning regular expressions: https://nim-lang.org/docs/strscans.html

2

u/daggerdragon Dec 02 '20

might end up submitting for getting crafty

Aww yeah I'm so hype for seeing the crafts y'all come up with!

psst, I think you left fancypants editor on because your Markdown is showing in old.reddit.

2

u/pietroppeter Dec 02 '20

ok, I fixed it. And took the opportunity to actually go and see old.reddit and man it is sooo much better.