Thanks Homer.

    • BatmanAoD@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      7 months ago

      Is there usually less parsing? I haven’t participated in previous years. (I guess I can just check the previous years’ problems, but there are a lot of those.)

  • learningduck@programming.dev
    link
    fedilink
    arrow-up
    4
    ·
    7 months ago

    I don’t want to read the number string from both left to right and Ruth to left. So, I

    1. iterate through each row and read the number string from left to right
    2. Store each number along with its cell range. ie: 467 is 0-2.
    3. Then from each symbol, find out if the position of the symbol +/-1 falls into any range. If so then sum that number.
  • Black616Angel@feddit.de
    link
    fedilink
    arrow-up
    3
    ·
    7 months ago

    Day one really got me with those pesky overlapping words like eightwo or twone.

    Today was actually really easy the way I did it.
    I searched through all the characters of the lines and when I got one that wasn’t a number or a period, I looked at all the 8 places around to find the numbers. The numbers I completed by looking in both directions until I got a non-number.
    Then I put all numbers and their starting positions in an array, deleted the duplicates and summed them.

    By doing this, question 2 only took me 4 minutes.

    • UndercoverUlrikHD@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      7 months ago

      Hmm, I did it the opposite. Found every number and passed a list of every adjacent position of the number to check for non-digit/dot/non-whitespace.

      Took a bit longer to solve part 2 due to that approach though.

  • Ananace@lemmy.ananace.dev
    link
    fedilink
    arrow-up
    3
    ·
    7 months ago

    2D grids and parsing data from them in all manner of interesting ways is a real AoC staple.

    I’m still hoping to be met with a problem at some point which can be solved by handling it as a type of funge program.

  • Mikina@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    7 months ago

    So far I’ve usually had success with just going for regex, but the second challenge today bacfired quite spectacullary. I’m still postponing having to rewrite my solution, because unfortunately it’s not really possible to have 2D regex (as far as I know, would be awesome).

    I guess just going with some kind of flood algorithm will be the way to go, but that’s effort