;
.....:....
.:x;:x+:.
.+x:+.
..:..;.
..;x:.:.
... ..+X;;++
.x+;x:X+x$::..:
;$Xxx:x;xxx..
... ++xxXxx+;;.....
.:X$++;+XX:;+++;+
....X.$xXxx;++;:+...
.+$$$$xX$$X+X$x;;xx......
. ..:$X$X..x$XXx+x$&....... ........ .
..+.&$$xxXXXxxXxxXX.;;;.x+.. .:&XXX:.......
...x.&..+$$X+$$$X$.xxXxX:+x:+xX.. .XXX::.......:..
XX$$&+$$$Xx.:x$$xXx.XX$xXXXxx;... .XX+;;++;:::;...
..:.x&&X$$$$$xX$$$X$$xXXXX$XX:x.. .. ..$Xx+x:+;x&+:..:..
...+&$$&:XXXX$XXXxxX+XxX+.+;;.;;.. .:$$Xx:.;xx$:.;.:+.
;X&&&&$$&$XxXX;+XxX++XXxx+++++:.. .+$$$+::.;..;...;::
......xX$&$$&$$$X:.++:.:;xx+X$++;;.:....&$$;::.....+&:...... ..XX...+xxxx.
.:.:.XX+$$&&$$$$.$$x$$+$+;:;xXX&x$$X$X;+;:x:&&;;:................ ..$X;XXXXXXX$
.X$$X;xXx&x.XX&$$&&$$$$&$XXXXx+:+XxXx:XXX$XXXXXXX:........ . .. .;$XXXXXXX:..
.xXxXXXx&&X;XXX$$$$$;+$&$&X$Xx+xx+X+;X+X+:$X$&.xXXXXXXX............... ...&$$$$X$.
. :+$$$&$XxXXXX$XxX:x$$$$$x:$XX$x$$X:;$X$X$X.....$XXXX:.:....... ..:. .....$$$:.
.:x+x$XX+Xxx+;x$x$+$$$:XXXXXX$X$+xx$.$:X$XX$XXX....:$$XXX+::.......:XxX. .X....&:..
.$.......;+;++X&XXX$$&$$$$&X$XXXXxX&$$&$$+XXX$$$XXXXX....x$$XXx$$;:+:..XXxxXXX;X$.....:;.
. $&...+.X.;.$x&$&$$$$&$$x++xxxxxxXX$+&XxXXX$$XXXXXXX$::::$$XXX$XXXXX&XXXXxxXX$$XX:::;;;
...$x$XX.$&XX$&X$&$XXXXX$&$$&$x;+;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;;:::........................
.&x.;X$$$$&$&XXx&XX&XXXX&.$&&$&$$x$$$$x$$$$$$$$$&&&&:;;;;:::........................
..$$&&$x$&&$&;$X$$$$$&&&&$$&XXX$&$$$X$+X$$$$$$$$&&&&&&&&&&&&::::.......... .........:.
.::.$&;.+$xXXx$$$$$$$&&$Xx$$$$$$X$X$:++XxX$Xx&$$$&&&&&&&&&&&$$$$$$XXXXXX&$$$$$$XXXX.
..+$X&+$$;xX$$$$$$&&$$&+$XX$$$&$$$$&$X$$$X$$$XXXx&&&&&&&&&&&&$$$$$XXXXXXx&$$$$$XXXXX.
.XXXX:;$$+xX&$$+$&$&&x++xXX&&$X&;$$X$XXX$++X$$&$$$$&&&&&&&&&$$$$$XXXXX:.;&$$$$$XXXXx.
..:+$$$&..x$$$$+.X$x+:+;;$;xX+&$X.+&X$X&&$&$$&.+$$Xxx..:.:$$$$$$XXXX$ &$$$$$$XXX..
XX... ..X&...++. .;XX;X$;;;+.....:$&&&&&&&& . &$$.x...;;$$$XXXXX.x..:.++;.......
. x.. .XXxXx:X$++..Xx.:xX&X&&&$$....x++++.:;;::...... ..;;:::.....
.. ..XXX..+XX$X+$$x&$XX;;x&&$X;:$$Xxxx+;;;;:::..... ..;::::.....
............::;;;xX;:$$$X+xx+$x$$Xx;;x$$$&XxxX$$$X+x;X;:::............$&&&&&X
...........::::::XX$Xx++X$X$;x;;$x$$xX+;x$X.x&$xX$++++x;;&&&&$:x:::......$&&&&&X.
..............:::.;Xx+X$XX:X;;$x&x+X$+Xx$$$&&;X$X$;X+x&&&&&$:x........:$&&&&&;&
....:....:...X:x.:....:+.xX$:;$:XX+.$;:::++..:&&$x&.... $&&&&&&&&&...
.........;&&&&&&... ......&&&+&&&&&&&$+
. .......:&&&&+.... .................
"'Twas the night before Christmas, and all through the code,
Not a bug was stirring, not even a node..." ๐
Ho ho ho! This repository contains my solutions for the Advent of Code 2025 challenge, where I'm sleighing through algorithmic puzzles one TypeScript solution at a time! Each day brings new coding challenges that would make even Santa's elves scratch their pointy hats. ๐งโโ๏ธ
๐ adventofcode2025/
โโโ ๐ 1/ # Day 1: Safe Cracking Adventure
โ โโโ ๐ crackSafe.ts # Combination lock simulation
โ โโโ ๐ input.txt # Secret combination steps
โโโ ๐ 2/ # Day 2: Gift Shop Pattern Detective
โ โโโ ๐ patterns.ts # Invalid product ID detection
โ โโโ ๐ input.txt # Product ID ranges to check
โโโ ๐ 3/ # Day 3: Battery Joltage Calculator
โ โโโ โก joltage.ts # Battery bank optimization
โ โโโ ๐ input.txt # Battery joltage ratings
โโโ ๐ 4/ # Day 4: Forklift Paper Roll Optimization
โ โโโ ๐ forklift.ts # Paper roll accessibility analysis
โ โโโ ๐ input.txt # Paper roll grid layout
โโโ ๐ 6/ # Day 6: Cephalopod Math Homework
โ โโโ ๐งฎ cephalopodMath.ts # Space-delimited worksheet parser
โ โโโ ๐ input.txt # Math worksheet data
โโโ ๐ 7/ # Day 7: Tachyon Manifold Repair
โ โโโ โก laboratories.ts # Beam splitting simulation
โ โโโ ๐ input.txt # Laboratory grid layout
โโโ ๐ 8/ # Day 8: Junction Box Circuits
โ โโโ โก junctionBoxes.ts # Christmas light circuit optimization
โ โโโ ๐ input.txt # Junction box 3D coordinates
โโโ ๐ฆ package.json # Dependencies & scripts
โโโ ๐
README.md # You are here! Ho ho ho!
"Santa's locked the password behinf a ... password?!"
The elves need help opening Santa's combination safe. Using a series of left and right rotations, we simulate the knob movements and track how many times we pass through or land on specific values.
Features:
- ๐ Safe simulation with customizable parameters
- ๐ฏ Part 1: Tracks landing on a given position
- ๐ฏ Part 2: Tracks the amount of pass-throughs on a given position
- ๐ Handles wraparound rotations like a real safe
"Invalid product IDs are sneaking into the North Pole gift shop database!"
A mischievous young elf has been adding invalid product IDs with repeating digit patterns. Our job is to identify and sum up these problematic IDs across various ranges.
Features:
- ๐ฏ Part 1: Detects patterns repeated exactly twice (55, 6464, 123123)
- ๐ฏ Part 2: Detects patterns repeated at least twice (111, 12341234, 1212121212)
- ๐ Processes large ranges efficiently
- ๐ Comprehensive pattern detection algorithms
"The escalator needs power, and we've got batteries to spare!"
The underground escalator is offline and needs joltage from battery banks. Each bank contains multiple batteries with joltage ratings from 1-9. We need to select the optimal batteries to produce maximum joltage.
Features:
- โก Part 1: Selects 2 batteries per bank for maximum 2-digit joltage
- โก Part 2: Selects 12 batteries per bank for maximum 12-digit joltage
- ๐งฎ Uses greedy algorithm for optimal battery selection
"Help the printing department optimize their forklift operations!"
The printing department has paper rolls scattered across a grid, and forklifts need to access them efficiently. A paper roll can only be accessed if it has fewer than 4 adjacent paper rolls. Help optimize the workflow so forklifts can break through to the cafeteria!
Features:
- ๐ Part 1: Identifies initially accessible paper rolls
- ๐ Part 2: Recursively removes all possible paper rolls until none remain accessible
- ๐ Grid-based neighbor counting in 8 directions
"Help the cephalopods parse their space-delimited math worksheets!"
The cephalopods need help with their homework - parsing numbers and operators from a space-delimited worksheet format. The challenge involves correctly identifying column boundaries and extracting vertical number sequences.
Features:
- ๐งฎ Space-delimited parsing: Handles variable spacing between numbers and operators
- ๐ Column detection: Identifies operator positions to determine column widths
- ๐ข Vertical number construction: Reads numbers vertically from worksheet columns
- โ Math validation: Performs calculations to verify worksheet correctness
"Fix the teleporter by simulating beam splitting through laboratory equipment!"
Repair the teleporter's tachyon manifold by tracing light beams through a laboratory filled with splitters and mirrors. The beams split and bounce in complex patterns that must be carefully tracked.
Features:
- โก Part 1: Simulate beam splitting and count unique beam paths (Result: 1594)
- โก Part 2: Count quantum timeline variations with memoization (Result: 15,650,261,281,478)
- ๐ Grid simulation: Track beam positions and directions through laboratory equipment
- ๐ง Memoization: Optimize recursive calculations for massive timeline counting
"Help the Elves connect Christmas lights across the playground!"
The Elves need to connect suspended junction boxes with strings of Christmas lights. Find the optimal connections to create circuits while minimizing cable usage. The solution uses graph theory and Union-Find data structures.
Features:
- โก Part 1: Connect 1000 shortest pairs, calculate product of three largest circuits
- โก Part 2: Connect all boxes into one circuit, find final connection coordinates
- ๐ 3D distance calculations and minimum spanning tree algorithms
- ๐ Union-Find data structure for efficient connectivity tracking
- Node.js (v16 or higher) - Santa's workshop runs on modern tech!
- npm - For managing our magical dependencies
# Clone the North Pole repository
git clone https://github.com/sanderslagman/adventofcode2025.git
cd adventofcode2025
# Install the magic dependencies
npm installDay 1 - Safe Cracking:
cd 1/
npx tsx crackSafe.ts
# Follow the interactive prompts or modify input.txtDay 2 - Pattern Detection:
cd 2/
# Add your puzzle input to input.txt, then:
npx tsx patterns.tsDay 3 - Battery Joltage:
cd 3/
# Add your puzzle input to input.txt, then:
npx tsx joltage.tsDay 4 - Forklift Optimization:
cd 4/
# Add your puzzle input to input.txt, then:
npx tsx forklift.tsDay 6 - Cephalopod Math:
cd 6/
# Add your puzzle input to input.txt, then:
npx tsx cephalopodMath.tsDay 7 - Tachyon Manifold:
cd 7/
# Add your puzzle input to input.txt, then:
npx tsx laboratories.tsDay 8 - Junction Box Circuits:
cd 8/
# Add your puzzle input to input.txt, then:
npx tsx junctionBoxes.ts- TypeScript - Because even Santa's code needs type safety! โ
- Node.js - Powering the North Pole's computational sleigh
- tsx - For running TypeScript faster than Rudolph flies
Each solution follows these North Pole coding standards:
- โ๏ธ Clean & Readable: Code so clear, even the reindeer can understand it
- ๐ Well Documented: Comments more detailed than Santa's naughty/nice list
- ๐ง Modular: Functions organized like Santa's workshop - everything in its place
- ๐ฏ Efficient: Solutions that run faster than Santa's sleigh on Christmas Eve
Fritzo (Sander Slagman) - Chief TypeScript Elf ๐งโโ๏ธ
"Debugging code by day, spreading Christmas cheer by night!"
Found a more elegant solution? Want to add some extra Christmas magic? Pull requests are as welcome as milk and cookies on Christmas Eve (Or gifts, gifts are even better)! ๐ช๐ฅ
This project is licensed under the Christmas Spirit License - feel free to use, share, and spread the coding joy! ๐โจ
โ๏ธ โ๏ธ โ๏ธ โ๏ธ โ๏ธ โ๏ธ โ๏ธ โ๏ธ โ๏ธ โ๏ธ
๐ May your code compile clean and ๐
๐
your algorithms run bright! ๐
โ๏ธ โ๏ธ โ๏ธ โ๏ธ โ๏ธ โ๏ธ โ๏ธ โ๏ธ โ๏ธ โ๏ธ
Merry Coding! ๐โจ
P.S. Remember to leave some cookies for the debugger! ๐ช