Day 10: Factory

Megathread guidelines

  • Keep top level comments as only solutions, if you want to say something other than a solution put it in a new post. (replies to comments can be whatever)
  • You can send code in code blocks by using three backticks, the code, and then three backticks or use something such as https://topaz.github.io/paste/ if you prefer sending it through a URL

FAQ

  • mykl@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    edit-2
    5 days ago

    Uiua

    (added language tag)

    Quiet here, isn’t it?

    Here’s part1 to be going on with.

    # AOC 2025 Day 10 - Wiring maze
    D ← "[.##.] (3) (1,3) (2) (2,3) (0,2) (0,1) {3,5,4,7}\n[...#.] (0,2,3,4) (2,3) (0,4) (0,1,2) (1,2,3,4) {7,5,12,7,2}\n[.###.#] (0,1,2,3,4) (0,3,4) (0,1,2,4,5) (1,2) {10,11,11,5,10,5}"
    # D      ← &fras"randomAOC/AOC2025day10.txt"
    Digits ← ⊜⋕⊸∊+@010
    Parse  ← ⊜(□⊜□⊸≠@\s)⊸≠@\n
    Part₁ ← (
      ≡◇(
        =@#↘₁↘₋₁°□°⊂↘¯1  # target
        ⊙⬚0≡◇(°⊚Digits)  # presses
        ⧻⊢path(≡⌞≠|=0/+) # find shortest path
      )
      /+-1
    )
    Part₁ Parse D
    

    I’ve given up on Part 2. I knew what I needed to do but didn’t have the understanding of how to use the matrix elimination method to get beyond the first stages. But I did find this:

    How to solve part 2 without libraries

    This is a solver written totally from scratch in Dart, so easily readable unlike some other languages :-): [https://github.com/ayoubzulfiqar/advent-of-code/blob/main/2025/Dart/Day10/part_2.dart](GitHub link)

    There’s lots of parallelism (that’s over the top for this problem), but the core solveSystem method is very clearly written, just long…