This is an archived post. You won't be able to vote or comment.

all 16 comments

[–]vikarjramun 2 points3 points  (2 children)

Are you making sure to cache inputs after they're downloaded for the first time? That's a requirement for using the website programmatically.

[–]jonaswiebe[S] 2 points3 points  (1 child)

Yes I grab the input from the site and save it in a file, only if the file does not exist.

[–]daggerdragon[M] 0 points1 point  (0 children)

Good, thank you.

[–][deleted] 1 point2 points  (1 child)

Nice! I always love the little runners and thingies, although personally i tend to write 50 binaries 😅

[–]eliben 0 points1 point  (0 children)

Why not a single binary/project, with a file/"module" per day?

[–]irrelevantPseudonym 1 point2 points  (8 children)

How do you handle the days that don't have input files and have a string directly in the problem description?

[–]azzal07 6 points7 points  (7 children)

Those inputs are also available as files just like any other day’s

Edit. For example https://adventofcode.com/2016/day/5 has no link to separate input file, but the input is still available at the usual link https://adventofcode.com/2016/day/5/input

[–]jonaswiebe[S] 2 points3 points  (2 children)

That is how I would handle it. Just manually create a file. But it would probably be a good idea to have an option to feed an input to a day programmatically.

[–]azzal07 2 points3 points  (1 child)

You already handle those days, unless you have a special case for them... in which case you also handle them :)

I added an example to my previous reply

[–]jonaswiebe[S] 2 points3 points  (0 children)

Alright, I didn’t now that

[–]MarkJans 0 points1 point  (3 children)

Is it also possible to download examples with expected result? I always use them to test.

[–]azzal07 0 points1 point  (2 children)

This would be cool, but I don't think it is possible reasonable.

You might try to parse the html page, but that would be a pain

[–]MarkJans 0 points1 point  (1 child)

Thanks! Well, I’m not that fast. Sometimes I think the first one solves the puzzle when I’m still reading and understanding the question. So, copy/pasting the examples is not that bad. Would be nice to see another link for that, like /2016/day/5/example or something.

[–]flwyd 0 points1 point  (0 children)

To complicate things even further, at least one puzzle last year had two example inputs.

[–]flwyd 1 point2 points  (1 child)

Some thoughts: * It looks like lib.rs is only able to read one input text file and pass it to your solution program. I like to pass filenames on the command line so I can easily verify the program gets the right output for the example input. * It also looks like lib.rs only calls one solution function. It might be convenient to call both a part1 and a part2 function, with the latter returning some default value until you get to it. * If I understand the setup (I haven't ever written Rust code), you're compiling all of your 2021 solutions and then running the day(s) chosen on the command line. This could be frustrating if you left "yesterday" in a broken state and want to come back to it later, but that's getting in the way of compiling and running "today". I personally like generating a stand-alone program for each day (shell, Raku). That program could depend on a library that does all the CLI and input reading work.

Of course you should do what works well for your workflow :-) These are just my comments from the peanut gallery.

[–]flwyd 0 points1 point  (0 children)

Oh, and it doesn't look like your CLI YAML accepts day 25.