ok so basically
i'm doing advent of code again
join my shark-themed private leaderboard!!! send me a DM for the code on masto or something (don't reply to this blog post i might not see it). the semi-official chat for it is just the blåhaj-ctf matrix channel
my code is located here: https://git.lain.faith/haskal/aoc2020
like last year, i'm doing it in racket. despite knowing racket a lot better than when i was using it last year, i'm doing racket again because i feel like there's still a lot of space to explore in writing creative and concise solutions using stdlib (and some choice non-stdlib) functionality
my goals for this year's effort are to write (or at least end up with) clean, readable, and concise code. the actual readability aspect will be prioritized over efficiency in cases where efficiency doesn't matter that much, and i'm going to make a good effort to create solutions for part 1 of each challenge that end up being as extensible as possible to part 2, even when i don't know what part 2 will be yet (this is one part of advent of code that can get pretty interesting, and the part that really trains you to be a better SWE if you pay attention to it)
i'm currently up-to-date with day 4, and my repo additionally contains scripts i've developed for interacting with the AoC system, some of which could be reused even if you're not doing racket
scripts/get-challenge <n>
: display's the nth day's challenge page, roughly styled to a (256color) terminalscripts/get-input <n>
: downloads the input file for day nscripts/submit-answer <day> <part> <answer>
: submits an answer. my template for solution scripts includes a bit of code i wrote that automatically submits answers as soon as they are calculated without error using the code behind this script
if you're using racket, scripts/template.rktrkt
is my template (in scribble that outputs racket :3), scripts/make-day
creates a new solution script according to the template, and scripts/*.rkt
is the support code for interacting with the AoC server and recording which problems have been successfully submitted
you can see my day 2 code as an example
(module+ main
(define input (file->lines "inputs/2"))
;; part 1
(answer 2 1 (calculate password-valid-part1? input))
....
when run for the first time, it'll prompt
$ racket 2.rkt
answer 2.1: <answer>
submit? [Y/n]:
hit y or enter and it submits. pretty handy if i do say so myself (i do)
that's all for now
i'm having a lot of fun with AoC so far even though the challenges are still uninteresting (it's week 1, of course)
let's hacking~ !!
Comments
No comments yet. Be the first to react!