Advent of Code 2022 Day 18 Walk-Through

Поділитися
Вставка
  • Опубліковано 11 жов 2024
  • adventofcode.c...
    github.com/hyp...
    Please attempt the problem on your own before watching this video!
    My Discord server: / discord

КОМЕНТАРІ • 5

  • @kayebennett7867
    @kayebennett7867 Рік тому +2

    In my case, I worked with the cubes themselves. What I do for the first part is: loop over each droplet, add it to a lava set, create a new set with the 6 neighbours, and then add 6-2*len(lava&neighbours) to the total area. For the second part; for each cube in the stack, loop over all non-visited neighbours. If they are in the lava set, add 1 to the area, if not, mark them as visited and add them to the stack.

  • @flwi
    @flwi Рік тому

    Nice, another walk through. Thanks! Good idea to store the faces that way.
    At 8:31 you mentioned there might be a smarter way to edit those lines.
    My favorite workflow for that kind of stuff is multi-cursor-mode. I'd have used "Duplicate Line" 2x (easier than copy/paste including the newline, because the cursor stays where it is) and then multiple cursors to edit the three lines simultaneously.
    The commands I use all the time are
    "Add cursor above/below" and
    "Add Selection Next Find Match". You can find them in the command palette and assign a shortcut to them. I use (cmd+alt+up/down and ctrl+g and ctrl+shift+g to undo the expansion)
    Especially the last one is quite handy. When your cursor is inside a word (or you selected something), it expands the selection with the next match, but you can use several cursors at those selections.
    Maybe that's helpful to you as well, but you're also super fast at typing, so it might not. ;-)

  • @looploop6612
    @looploop6612 Рік тому

    I don’t get how two cube is connected.

  • @TTaiiLs
    @TTaiiLs Рік тому

    Your solutions are insane and the explenation is so good, 10/10

  • @fredoverflow
    @fredoverflow Рік тому

    No need to model the surfaces explicitly: uhDfedwq03A, if you have 5 minutes to spare