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.
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!
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`
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.
@@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.
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
Such a great contest for all skill levels. Love the tips!!!
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.
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!
wow looking at the leaderboard I see you're #1 for a good few. Thats crazyyyyy
Thanks for the tips and good luck
❤🎉 So inspiring! Thanks for the advice!
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`
pleeeeease can you do previous years walkthroughs too?! Your video solutions are so helpful!
Podium this year!
Hello can I ask what is open(0).read(), is it the same as input() and if it is, why use it over input?
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.
@@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.