My Advent of Code 2025 solutions, made with WASM text format

to bottom ↓
Day 1: Secret Entrance This one wasn't too hard; it was the first day, after all.
Part 1 and 2 are basically the same, just where part 1 rotates e.g. left by 58 once, part 2 rotates left by one 58 times.
Not a great algorithm, but eh
Day 2: Gift Shop Part 1 of this wasn't very complex; had to do some funny math to check for repeating numbers but that was basically it.
Part 2 did throw in some more complexity, but part 1's code was adaptable to it well enough.
Day 3: Lobby Part 1 of this got a brute-force solution: try every possible first digit with every possible end second digit.
Part 2 forced a more clever solution - I realized I didn't have to check every combo, as a larger first digit would always produce a bigger joltage; so I just had to check for the first largest number in range for each digit.
Day 4: Printing Department This one wasn't that bad with memory set up well; with the rows spaced out from eachother with a constant offset, I can just check e.g. 257 bytes back in memory and find the cell up and left in the grid.
Part 2 was just part 1 in a loop and removing rolls when counted.
Day 5: Cafeteria Part 1 wasn't too bad; scan the ranges into memory, then check each ingredient against all ranges until one works.
Part 2 was way harder, for three reasons: ranges could overlap, ingredients in two ranges should only be counted once, and going through the whole ingredient range manually would take hours even on the best CPUs. I did eventally come up with a solution I liked:
  1. For each range, check if its end numbers are in any other range.
  2. If either end is, combine the two ranges in question by setting one range to the minimum minimum and the maximum maximum, and the other to 0-0 (which would be ignored later).
  3. If any range is combined, restart checks for the current range as to not accidentally miss a range that's now in reach.
  4. Once all ranges have been checked, none will overlap. Add up the sizes of all ranges +1, and return.
Day 6: Trash Compactor Part 1 was pretty simple - just loaded each number into memory, recorded how long the row was, and read * and + to check what operation to do
The main change for part 2 was reading digits instead of numbers, and not skipping spaces. Then, I could iterate through each column, read the */+ conveniently positioned at the start of the problem, and read numbers down from the column.
For detecting blank columns, I could take advantage of the fact that zero doesn't appear anywhere in the input; so if I read a column as zero, it was definitely blank.
Day 7: Laboratories This one ended up pretty simple; keep a target row and a source row of memory, read the line, apply the correct behaviour, and swap rows for the next line.
Part 2 also had a simple solution; instead of writing 1, write the number of rays the space currently represents. The count of lasers at the end can be adapted from the split count, just start with 1 and add the number of rays split when a splitter is hit.