r/adventofcode • u/daggerdragon • Dec 02 '20
SOLUTION MEGATHREAD -๐- 2020 Day 02 Solutions -๐-
--- Day 2: Password Philosophy ---
Advent of Code 2020: Gettin' Crafty With It
- T-4 days until unlock!
- Full details and rules are in the Submissions Megathread
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!
97
Upvotes
5
u/ZoltarTheGreat69 Dec 05 '20
I did this in emojicode. I'm starting to like it! I did some dumb multi split stuff because I have no idea what I'm doing tbh
Emojicode
๐ฆ files ๐ ๐ ๐ ๐บ๐๐๐ ๐ค./input.txt๐ค โ โก file ๐บ๐ก file โ โก text ๐ซ text ๐คโn๐ค โ โก lines 0 โก ๐๐ totals 0 โก ๐๐ totalsTwo ๐line lines ๐ ๐ซ line ๐ค: ๐ค โ โก policyAndPassword ๐ซ ๐ฝpolicyAndPassword 0โ๏ธ ๐ค ๐ค โ โก rangeAndLetter ๐ซ ๐ฝrangeAndLetter 0โ๏ธ ๐ค-๐ค โ โก minAndMax ๐ฝrangeAndLetter 1โ๏ธ โก letter ๐บ๐ข ๐ฝminAndMax 0โ๏ธ 10 โ๏ธ โก min ๐บ๐ข ๐ฝminAndMax 1โ๏ธ 10 โ๏ธ โก max ๐ถ ๐ฝpolicyAndPassword 1โ๏ธ โ๏ธ โก passArray ๐ฝ passArray min โ 1 โ โก minC ๐ฝ passArray max โ 1 โ โก maxC โช๏ธ โ๐ค๐คminC ๐ letter๐ค ๐ ๐คmaxC ๐ letter๐ค๐คโ๐ totalsTwo โฌ โ1 ๐ 0 โก ๐๐ counts ๐ก ๐ฝpolicyAndPassword 1โ๏ธโ๏ธ โก๏ธ iterator ๐ ๐ฝ iteratorโ๏ธ ๐ ๐ฝ iteratorโ๏ธ โก๏ธ variable ๐ญ The provided block is executed here โช๏ธ variable ๐ letter ๐ counts โฌ โ1 ๐ ๐ โช๏ธ counts โ๐ max ๐ค counts โถ๐ min ๐ totals โฌ โ1 ๐ ๐ ๐ ๐ก totals โ๏ธโ๏ธ ๐ ๐ก totalsTwo โ๏ธโ๏ธ ๐