Rules: no spoilers.

The other rules are made up as we go along.

Share code by link to a forge, home page, pastebin (Eric Wastl has one here) or code section in a comment.

you are viewing a single comment's thread
view the rest of the comments
[–] [S] 4 points 2 years ago (2 children)

Perl: https://github.com/gustafe/aoc2023/blob/main/d01-Trebuchet.pl

thoughts

I found this really tough for a day 1 problem. Because I don't really know regex, I did not know the secret to finding overlapping patterns. I quickly figured out that "twone" was a possibility, because it was in the example, but then I had to find other examples and hardcode them into my split pattern.

This isn't general, my input doesn't have 'sevenine' for example.

  • source
  • parent
  • hideshow 4 child comments
  • [+] 4 points 2 years ago (2 children)
  • [–] 3 points 2 years ago (1 child)

    absolutely — removing my dependency on GitHub has actually been a blocker on me releasing code lately, and it’s something I want to tackle when we launch that open source community. if it helps collaboration, I can provide some ultra-janky git hosting on awful.systems with the same service that hosts our infrastructure code, though this’d be just basic git and gitweb with ssh public key auth

  • source
  • parent
  • hideshow 2 child comments
  • [+] 4 points 2 years ago* (3 children)
  • [–] [S] 4 points 2 years ago (1 child)

    Re Perl findall, I used this regex in my "clean" solution which I didn't post because I figure it's more honest to submit what worked, not the smart stuff you found out later.

    regex

    # find all numerals and number in English from the string $line and put them into the array @spelled my @spelled = ( $line =~ (m/(?=(\d{1}|one|two|three|four|five|six|seven|eight|nine))/g );

  • source
  • parent
  • hideshow 2 child comments