Every December, thousands of developers confidently open Day 1 of Advent of Code — and by Day 10 are questioning their career choices. Here is the AoC experience in code.
Day 1: Peak Confidence
# Day 1 — "This is going to be my year"
with open("input.txt") as f:
data = f.read().splitlines()
# Part 1: trivial
answer = sum(int(x) for x in data)
print("Part 1:", answer) # got it in 3 minutes
print("Part 2:", answer * 2) # first try!!
# Current leaderboard: #127 globally 🏆
Day 10: Reality Sets In
# Day 10 — 4 hours later
# Stack: empty
# Morale: also empty
def solve(grid):
# TODO: understand the problem first
# TODO: understand what a "topology" is
# TODO: why is this a graph problem??
return "💀"
print(solve([])) # incorrect, but I tried
# Reddit thread: "Is anyone else crying?"
# Top answer: "Yes. We all are."
Day 25: Survivor's Code
# Day 25 — you made it
def final_star():
# All 49 stars earned
# Sleep debt: 36 hours
# Productivity lost: $12,000
# Worth it: absolutely
return "🌟" * 50 # 50th star (the real prize)
print(final_star())
print("See you next December.")
print("(I say this every year)")
The Input File Experience
// JavaScript — every AoC morning
const fs = require("fs");
// Step 1: Download input
const input = fs.readFileSync("input.txt", "utf8").trim();
// Step 2: Stare at it for 10 minutes
console.log("What even is this:", input.slice(0, 50));
// Step 3: Check Reddit for hints
// Step 4: Feel bad about checking Reddit
// Step 5: Use the hint anyway
Generate "Advent of Code" or any puzzle phrase at LoveSyntax.com. See you in December.