4 ms·
Show HN: Advent of Code CLI
- isoprophlex 3y ago> Tool to automate downloading and submitting advent of code problems. Well... the biggest use case I can think of is automated, AI assisted, problem solving. Which isn't really aligned with the spirit of AOC. In fact they politely asked people not to, if I'm not mistaken.
- TDiblik 3y agothe first usecase I thought about was the tryhards that want to save every second :D ... idk there could be a legitimate usecase
- isoprophlex 3y agoI guess they could just ditch the competetive rankings altogether now with AI coding assistants. Keep the star system to keep track of what you did yourself, at most.
- forgotpwd16 3y agoThat's exactly what it's. Anyone trying to rank (and even if not) had a tool such as this built since AoC's origins years before AI coding solutions. Seems nowadays for many people any kind of automation implies AI assistance.
- cybrox 3y agoThis won't really make a difference in that regard. If you wanted to use AI, you could copy the input/output or just use their API directly. I personally use a solution like this because I'm just plain and simply lazy.
- ttobi 3y agoI am actually using it to submit my solutions without leaving the editor (out of lazyness). I just need to run `aoc submit <my-solution>` and immediately get feedback if I am correct. If that it the case, it automatically downloads the second problem so I can immediately continue. As explained in another comment I'm not participating competitively. I just really like automating things. I also think that AI assisted program solving if against the spirit of AoC, so I will add a note to the readme to discourage it.
- Bjartr 3y agoNice job scratching your own itch!
- riffraff 3y agoClever, I've automated input fetching years ago but never considered automating submission too, thanks for the idea.
- sk11001 3y agoDo we really need a CLI to replace Cmd-S and a copy/paste command?
- vulcan01 3y agoThis is probably for people who are trying to get on the leaderboard.
- ttobi 3y agoAuthor here. I am actually participating pretty causally at advent of code and don't try to get into the global leaderboards (I wouldn't be able to, even if I would try). I build the tool for myself last year because I like the comfort of not having to switch between terminal and browser. As I wanted to use it this year again so I decided to put it into a separate repo and to share it here. But I see the point that this a special kind of laziness not everyone can relate to :)
- BaculumMeumEst 3y agoi watch someone who consistently places top 5 on youtube. they code in vim on windows in the terminal, exit vim to run at the command line, and then copy and paste from the terminal into a browser.
- vacuity 3y agoNow the real question is, what does the top 1 person use? Emacs? VSCode?
- deleted 3y ago[deleted]
- rileymichael 3y agoI'd recommend setting the user agent to avoid getting blacklisted, info here: https://www.reddit.com/r/adventofcode/wiki/faqs/automation#wiki_put_your_contact_info_in_your_script.27s_user-agent_header https://www.reddit.com/r/adventofcode/wiki/faqs/automation#w...
- ttobi 3y agoThank you! I will do that.
- nikolay 3y agoI wonder why these are not available from the project directly and why input data is not in some standard format like JSON. Parsing the input for speed is the dirtiest part. If it was always in JSON, then at least that part would have been prettier! Last nights task I did with stinky code string-splitting for speed.
- lloydatkinson 3y agoI’ve often wondered why AOC and hackerrank and the like have you solving the required problem AND the implicit task of parsing the input.
- pitched 3y agoThe task of parsing the input is the only transferable skill in the whole thing.
- nikolay 3y agoBut you can't do a decent job if you want to earn points. Parsing requires diligence and less assumption. Add one extra space, and the whole AOC parsing leads to unpredictable results.
- lloydatkinson 3y agoOne of my solutions last year, with F#, was very aware of bad input and was robust against it. Here's a part of it: type Shape = | Rock | Paper | Scissors let parseCharacters (line: string) = let onlySingleCharacters (a: string, b: string) = a.Length = 1 && b.Length = 1 match line.Split() with | [| a; b |] when onlySingleCharacters (a, b) -> match a[0], b[0] with | 'A', 'X' -> Some(Rock, Rock) | 'A', 'Y' -> Some(Rock, Paper) | 'A', 'Z' -> Some(Rock, Scissors) | 'B', 'X' -> Some(Paper, Rock) | 'B', 'Y' -> Some(Paper, Paper) | 'B', 'Z' -> Some(Paper, Scissors) | 'C', 'X' -> Some(Scissors, Rock) | 'C', 'Y' -> Some(Scissors, Paper) | 'C', 'Z' -> Some(Scissors, Scissors) | _ -> None | _ -> None let rec readLines () = let line = Console.ReadLine() match line with | null | "" -> [] | _ -> match parseCharacters line with | Some parsedLine -> parsedLine :: readLines () | None -> readLines ()
- BugsJustFindMe 3y agoIt's funny to me how much of the code is just replicating behavior you would already have for free if you just had a small shell script that used standard tools like curl and sed, and it wouldn't need to be compiled, and it would be one single file instead of four with a nested source directory, and it wouldn't have 2000 lines of cargo config.
- ttobi 3y agoAbsolutely, the basic functionality could be easily hacked together with a small shell script. But parsing the html and converting it to markdown would be probably not possible without extra tooling (I wouldn’t feel comfortable doing it with sed). I also like that with the current implementation you are basically getting the “—help” argument for free. Using Rust for a simple tool like this is, of course, a total overkill and something like Python or Go would do the same job with much less code. But I enjoy writing Rust and was already using it to solve the AoC problems :) I also like the fact that the tool is now very easy to install with Cargo without me having to upload it to some package manager. The 2000 lines are in the Cargo.lock file, which is generated. The actual config is 18 lines. Of course having that many dependencies is worth criticizing.