Skip to content

syrchanan/advent_of_code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advent of Code

Overview

This repository contains my solutions to Advent of Code puzzles across multiple years and programming languages. I use this yearly event as an opportunity to learn new languages and techniques; it's kinda fun to look back

Browse by year below to see detailed descriptions of each day's approach and key techniques used.

Events

Click on the year to see the solutions for that year, or the day to see the specific day's puzzle (on the AoC site).

I wanted to learn OJS, so in 2024 I went back to use 2015 as a way to learn:

  • Days 1-15: OJS Notebook

    • Day 01: Floor tracking using reduce over ( and ) chars; Part 2 finds the first position that enters the basement
    • Day 02: Wrapping paper and ribbon, using map/reduce over box dimensions for surface area and smallest-side/perimeter calculations
    • Day 03: House visit deduplication, with direction chars mapped to coordinate deltas and visited houses stored as stringified coords in a Set; Part 2 splits instructions between Santa and Robo-Santa
    • Day 04: MD5 hash mining, iterating until the hash prefix matches target zeros (hardcoded results, commented-out loop)
    • Day 05: Nice string validation using regex checks for 3+ vowels, consecutive doubled letters, and forbidden substrings
    • Day 06: 1000×1000 light grid, applying on/off/toggle instructions over coordinate ranges using nested map/reduce
    • Day 07: Wire circuit simulation with bitwise AND/OR/NOT/LSHIFT/RSHIFT, using recursive dependency resolution until all wires have a value
    • Day 08: String encoding overhead; Part 1 compares raw vs eval'd length, Part 2 compares raw vs JSON.stringify length
    • Day 09: Shortest/longest route using recursive permutation generation over all city orderings, then min/max total distance
    • Day 10: Look-and-say sequence via regex matching of consecutive digit runs, repeated 40 then 10 more times
    • Day 11: Password increment with a character-by-character incrementer and regex validity checks (no i/o/l, two doubles, ascending triple)
    • Day 12: JSON number summing via recursive flattening of all values; Part 2 skips any object containing a "red" value
    • Day 13: Optimal circular seating using all permutations of guests, summing bidirectional happiness for adjacent pairs
    • Day 14: Reindeer race using fly/rest cycle distance math; Part 2 awards a point to the leader at each second and sums final tallies
    • Day 15: Cookie recipe optimization using recursive generation of all ingredient ratios summing to 100, with multiply-attribute scoring capped at 0 and a calorie filter in Part 2
  • Days 16-25: OJS Notebook

    • Day 16: Aunt Sue identification by building an MFCSAM property object and filtering 500 Sues; Part 2 uses range comparisons for cats/trees and pomeranians/goldfish
    • Day 17: Eggnog container combinations using bit-shift superset generation to enumerate all subsets summing to 150; Part 2 finds subsets of minimum size
    • Day 18: Conway's Game of Life, neighbor-count simulation over 100 steps on a 100×100 grid; Part 2 forces corner lights permanently on
    • Day 19: Molecule machine using regex-based string replacement permutations for Part 1; greedy reverse-substitution toward e for Part 2
    • Day 20: Infinite elves presents, using divisor-sum iteration to find the first house number whose present total meets the threshold

My first actual Advent, and right when I was learning R:

  • Day 01: Basic tidyverse pipeline, summing grouped calorie values and sorting with arrange(desc(...))
  • Day 02: Rock paper scissors scoring using named lookup vectors and case_when for outcome/shape logic
  • Day 03: Set intersection across rucksack compartments using string splitting with intersect; Part 2 uses Reduce for three-way overlap
  • Day 04: Range overlap detection using eval(parse(text=.x)) to expand dash-separated range strings into sequences
  • Day 05: Stack-based crate rearrangement using read_fwf for fixed-width input and list manipulation to simulate crane moves
  • Day 06: Sliding window packet detection using zoo::rollapply to find the first window of all-unique characters
  • Day 07: Filesystem size calculation using regex lookahead/lookbehind for path parsing and accumulate to track the current directory
  • Day 08: Grid visibility and scenic score using nested loops over a matrix, checking sightlines in four directions per tree
  • Day 09: Rope physics simulation tracking head/tail positions step-by-step; Part 2 generalizes to a 10-knot rope
  • Day 10: CPU cycle simulation with noop/addx instruction processing; Part 2 renders ASCII pixel art to a CRT screen
  • Day 11: Monkey in the Middle, using regex to parse multi-line input blocks into a structured tibble (parsing only)

Lost some momentum here, but will probably come back to this someday:

  • Day 01: Digit extraction with spelled-out number support, using regex extract with greedy match reversal to find the last digit
  • Day 02: Cube game validation using group_by + summarize to check RGB cube counts against thresholds; Part 2 finds the minimum cube set
  • Day 03: Schematic part number adjacency using crossing for coordinate offsets and a self-join to find symbols adjacent to numbers
  • Day 04: Scratchcard scoring; Part 1 uses exponential points, Part 2 implements a card-copying cascade via an imperative loop with a running count vector
  • Day 05: Multi-stage range mapping using chained seed-to-location conversion tables; Part 2 expands seed ranges (brute force)
  • Day 06: Boat race win counting, simulating all wait times per race with pivot_wider to reshape time/distance data

The real 2024, done after I learned OJS earlier in the year (seem to have lost the early days of this round):

  • All Days: OJS Notebook
    • Day 10: Trailhead pathfinding via recursive grid traversal; Part 1 counts unique summits per trailhead with a Set, Part 2 counts all distinct paths with flatMap
    • Day 11: Stone splitting over iterations; Part 1 uses simple flatMap, Part 2 switches to a Map of stone→count to handle 75 iterations without exploding array size
    • Day 12: Garden region fencing via flood-fill BFS with Set tracking; Part 1 multiplies area × perimeter, Part 2 counts polygon sides via corner detection
    • Day 13: Arcade claw machine using Cramer's Rule to solve button-press linear equations; Part 2 adds a large offset to prize coordinates
    • Day 14: Robot quadrant simulation using modular arithmetic for positions after 100 steps; Part 2 finds the Christmas tree frame by minimizing positional variance
    • Day 15: Warehouse robot box pushing via recursive collision chain detection; Part 2 doubles grid width and handles split-box vertical/horizontal collision logic
    • Day 17: Bytecode program emulator with combo operands and bitwise shift operations; Part 2 attempts reverse-engineering the program to find the initial register value (incomplete)
    • Day 18: Grid pathfinding with falling bytes using BFS for shortest path; Part 2 binary searches for the first byte that blocks all routes
    • Day 22: Pseudorandom sequence with XOR/shift, iterating 2000 steps for Part 1; Part 2 tracks all 4-consecutive-change sequences across buyers with a Map to maximize banana sales
    • Day 24: Logic gate circuit simulator with iterative AND/OR/XOR resolution; Part 2 identifies swapped gate outputs by analyzing full-adder structure (incomplete)
    • Day 25: Lock/key compatibility using bitwise AND to test if each lock+key pair fits without overlap, counting all compatible combinations

Knew Julia was supported in Quarto, and is an up-and-coming data science language, so wanted to give it a go:

  • Day 01: First day in Julia, getting used to typing - probably went overboard, but wanted to think through all the data structures
  • Day 02: String manipulation, regex, and map() with anonymous functions
  • Day 03: More complex while/for loops, vector manipulation
  • Day 04: First custom struct definition, and grid traversal (classic AoC puzzle)
  • Day 05: More structs, using begin and end for subsetting
  • Day 06: Realizing the differences in pipes between Julia and R, also how to use the broadcast operator . on both infixes and functions
  • Day 07: Learned about Julia's use of unicode characters, such as for "in"
  • Day 08: Union find data structure and algorithm implementation
  • Day 09: Geometry puzzle; pairwise rectangle area maximization within a rectilinear polygon, with validity checks for internal vertex containment and edge overlaps, using circshift for wrapping edge pairs
  • Day 10: //
  • Day 11: //
  • Day 12: //

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages