Advent of Code 2023 | General Tips

Поделиться
HTML-код
  • Опубликовано: 23 дек 2024

Комментарии • 14

  • @felix.delrubio
    @felix.delrubio Год назад +1

    Such a great contest for all skill levels. Love the tips!!!

  • @JimYoungman
    @JimYoungman Год назад +3

    Seems great, I changed it to use TS instead of JS just for my sanity but this a great way to get it all started

  • @RoboDragonJediKnight
    @RoboDragonJediKnight Год назад +9

    Good tips. I particularly like the utility scripts. Being able to automate these kind of repetitive actions, is invaluable for a tight feedback loop and being competitive for these time-based leaderboards.
    As a supplement to your current approach, you might consider using a "file watcher" like wach or nodemon or entr. That way you can facilitate rapid feedback on the command line, seeing changes to the output of your solution without switching to a terminal and typing `jaoc` or `aoc`. Instead, a save (Ctrl+S) could achieve the same result without the context switch.
    As an additional optimization you could research a way to copy the standard output to a clipboard if you want to quickly be able to paste the answer to the web browser with the problem open. You could also do this in your custom file watcher command that runs on file change.
    If you want to optimize away the copying and pasting the answer solutions to submit answers, the form submissions might be automatable using a similar approach to how you implement your `aoc-load` function. The http form I see submits an HTTP Post to a structured url, passing in the text answer and the level in the HTTP body. I'm sure you could use your session cookie as well for authentication.

    • @hyper-neutrino
      @hyper-neutrino  Год назад +7

      These are all really neat ideas, thank you for the suggestions!
      I was actually playing around with the idea of making an AoC IDE, and although I definitely won't have the time to get it done before this year's AoC ends, maybe you'll see it around on my channel sometime in the coming year 👀 I'll definitely keep these ideas in mind!

  • @MrCreeper20k
    @MrCreeper20k Год назад +1

    wow looking at the leaderboard I see you're #1 for a good few. Thats crazyyyyy

  • @astrocoastalprocessor
    @astrocoastalprocessor Год назад

    ❤🎉 So inspiring! Thanks for the advice!

  • @glitchinLife
    @glitchinLife Год назад

    Thanks for the tips and good luck

  • @alexanderchori8154
    @alexanderchori8154 11 месяцев назад

    It’s also may be useful to use Python’s assert keyword that lets you write more explicit assertion. And it works the same as the way with raising RuntimeError you shown.
    Example: `assert f > 0` to check if is is positive at some point or in your case it would be `else: assert False`

  • @lilmorphius
    @lilmorphius 11 месяцев назад

    pleeeeease can you do previous years walkthroughs too?! Your video solutions are so helpful!

  • @mathcat4
    @mathcat4 Год назад +12

    Podium this year!

  • @Efebur
    @Efebur Год назад +1

    Hello can I ask what is open(0).read(), is it the same as input() and if it is, why use it over input?

    • @hyper-neutrino
      @hyper-neutrino  Год назад +1

      open(0) opens standard input, which you can iterate through to get each line (you'll often see me do for line in open(0)). open(0).read() reads all of standard input at once, which when piping in from a file (as I always do), reads the whole file. input() works fine but iterating through open(0) stops when you're out of input and open(0).read() is useful if you want the whole file at once.

    • @Efebur
      @Efebur Год назад

      @@hyper-neutrino so I tried to read about it a bit and I’ve come up with these use cases. Are these correct?
      - If I want the next line of input: input()
      - If input is multiple lines and I want all of them as one big string: open(0).read()
      - If input is multiple lines and I want all of them split into an array: lines = [*open(0)]
      - If input is multiple lines and I want to iterate over them: for line in open(0)
      However I think the lines with open() include the
      character which input() doesn’t include as far as I know. Is this correct? Are there more use cases I should know about? Thank you very much.