This is the place to plug your blog, your source repo, your random flashes of inspiration regarding this year’s Advent of Code.
Through the magic of Github follows and / or RSS, those interested can easily keep up during the contest!
Other resources:
#lobsters-advent
on FreenodeThere are 2 leaderboards for this site, here are the codes
Thanks! Here’s to another year of giving up after a week.
Last year I tried doing every day in a different programming language. That didn’t last long.
If time wasn’t a problem, could you have done it? Being able to use 24 different langauges would be quite impressive.
Apparently I gave up 4 days in: https://git.sr.ht/~ianloic/AdventOfCode2019/tree but in that time I used one language I’d never used before (clojure - and I really have almost zero lisp/scheme experience) and two I hadn’t used in 20-25 years (TCL, DOS assembly language).
I had come up with a list of language I could use and remaining were 6 I currently use regularly, 8 I’ve used in the past but am still fairly familiar with and 17 that I haven’t used, but I’m sure I can solve simple problems in - I didn’t for example include prolog.
One thing that’s challenging is that the problems build upon each other so having to rebuild everything from the ground up in a new language each day is frustrating. If I could bring myself to dealing with a JVM I could try using a different JVM language every day because generally they have the ability to call into each other.
I did Clojure one year, it was good. Still use Clojure for lots of my coding.
I did Pharo Smalltalk one year. Convinced me to never use Smalltalk again. (I wanted it to be nirvana. It was not.)
This year I’m doing Racket. It’s much more of a Lisp than Clojure ever wants to be. Very different experience, and I’ve not yet made up my mind. If I can’t stand Racket, I’ll switch to Fennel partway through.
okay, I nerdsniped myself and I’m trying to do this again this year.
I made it to 20 languages: https://f5n.org/blog/2019/advent-of-code-2019/
Me too! I think I made it about 14 days or so? I shouldn’t have used my main languages for the early days
I did this for most of 2016’s! https://github.com/pablo-meier/advent-of-code 22ish days.
I usually make it to the third IntCode interpreter problem before I bail.
I am going to write up my Haskell solution at some point, but I liked this:
And it’s crazy fast:
I love the SQL solution. If you want to use it with a version of sqlite that shipped post-2004, change
COPY...
to.import day01.txt day_01
In part 2, what about using three
join
instead of theexists
?That would be better, yeah. This is basically a port of my Haskell solution, though.
Looks neat, and it’s also all one line of code! Woot!
Would love to see that done for the triples in the next section.
If everything keeps building on everything, that’s going to be a fun hunk of code to watch evolve. :)
It actually does both :)
If DDL does not count as code, would it be zero lines of code if I could make a macro that reports the solution in an error? Or maybe if one used dependently typed programming where the compiler can infer the solution? If I used Datalog, would the queries count as code, but that statements not? ;)
I believe you have a bug?
a.v <> b.v
should bea.id <> b.id
or something?Since the numbers are unique, they’re using that to make sure they’re not checking the number added with itself since that wouldn’t be a valid solution even if it added up to 2020.
Right. Does the problem specify that the numbers are unique? Perhaps I missed that.
It doesn’t, but
wc -l
andsort -u | wc -l
gave me the same number, so.Plus I assume you would’ve found out pretty quickly if they weren’t all unique when you tried to import them into a column with a unique constraint.
My first solution was in Haskell, so I had already determined that particular bit of data modelling.
Ah, I guess it makes sense that the SQL implementation wasn’t the one you started with.
The column in the table is named
v
.Is there just one column? I was wondering how you’d handle duplicates where the answer is a perfect square.
Yep, just the one. I cheated :)
Ah, the ol’ overtraining-on-single-input. Carry on :)
The Haskell version I ported from:
Tedious IO is left to the reader.
I’m just going to say that the title might be clickbait, because it sounds like “coming up with a solution for a problem in under a second”. Of course, it’s also my fault, for being naive enough to belive it. Perhaps I was expecting some APL-wizardry.
I had the same thought from my initial read of the title. I assumed they had done some really clever analysis of the previous problems to come up with potential new problems and solve them pre-emptively. Oh what the mind can come up with to justify something outrageous!
In any case, the title is both clickbait and completely accurate, if not slightly vague.
You can also join #lobsters-advent on freenode to chat about problems.
Joined!
Since the first one filled up, I set up a second one, code
400344-db76bd5d
to join.I’m trying to do it in machine code, but ok :)
This was a pretty fun read.
Regarding “readable and elegant” as being a virtue of a good language. As someone who doesn’t know Raku and isn’t familiar with perl, I have to admit that your example, for me anyway, was completely impenetrable. I’m not trying to burst your bubble, but on the other hand demonstrate how horribly subjective these things are. I’m in the process of trying to learn Haskell, and the example you gave actually had a very Haskell-esk/FP kind of feel to it.
Long story short, I might look into Raku.
This was really pleasant to read and was nice because it sounds like the author really just enjoys using Raku. Which is, perhaps, an underrated feature of our tools.
Thanks!
I definitely do. One of Raku’s key design goals is to be “optimized for fun” (
-Ofun
). This isn’t because Raku was built by a bunch of programmers who want to enjoy using it (though it was!). More importantly, we believe that making a language-Ofun
makes it better: software is fundamentally a craft, and making the tools of a craft more enjoyable to use naturally leads to an improvement in the finished product.Last year was the first year I finished all 25 days, let’s see if I can keep up this year as well. Doing it in Rust to see if I hate it a little less after forcing myself to use it for a while.
Just to clarify in case people wonder why I’m using a language I don’t like: I love the ideas behind Rust but so far haven’t gotten much enjoyment from actually writing it. I’m hoping by forcing myself to use it, I’ll get to the point where I feel like the compiler is helping me instead of a thing I’m fighting against, similar to how I feel when writing e.g. Haskell.
I’m going with rust as well (and I did the same last year). Not sure if this is the best language for something that’s practically throwaway code, but at least I get to exercise some of the patterns like reading stuff from files and common libraries like regex.
I’m doing the same! I posted my own comment to this thread, but I’m currently in the phase of shotgunning my code with
&
while I slowly learn how ownership works haha.I used Smalltalk last year to actually have practice with it.
At the end I decided it really wasn’t for me. But where else am I going to get four dozen coding problems with an artificial deadline and recorded metrics?
Can you be on more than one leaderboard at the same time?
Yes
Yes!
I took a look at Raku for the first time in a long time for this year’s advent.
I’ve already had several omg/wtf/wow moments. There seems to be a lot of very mature, interesting work here.
Lots of people will hate it (those who dislike sigils, more than one way to do things etc), but when I read that the for loop takes an iterable and a block, so you can use a “pointy block” and the arrow in the example code I was looking at was part of the block syntax, I was pretty amazed.
It seems like the language is built out of an interesting set of abstractions. I don’t know if I’m going to deep dive, but it is seems pretty exciting.
As someone who prefers book to learn a new programming language, which one would be the best? I see there is “Learning Perl 6” and the brand new “Raku Fundamentals”.
Since lobsters is publicly viewable, I don’t think that leaderboard is very private.
“Private” in this case just means it’s a namespace with a selection of usernames, with internal scoring.
I.e. in the global leaderboard (not visible by default), me and my buddy might be separated by thousands of entries. A private leaderboard just excludes anyone but those on it.
Private, not secret.
Today was fun!
I had seen the links and commentary in years past, but I always had something else to do. This year I might do a few. It reminds me of “nerd crosswords”, ie, fun little intellectual games to get the juices flowing first thing in the morning.
I’ll share my repo – I’m learning Rust right now and needed something to force me to write code in it so I can move out of the “throwing
&
at the code until the compiler stops yelling at me” phase of learning Rust :Dhttps://github.com/3digitdev/aoc2020
This post is day 1 of the 2020 Raku Advent Calendar, so there will be another 24 daily posts on Raku-related topics between now and Christmas.
The article links to the Advent of Raku 2020 Git repo, which is collecting Raku solutions to Advent of Code. The day one solutions have already presented multiple different approaches – just as you might expect from Raku!
Question from a noob: are we supposed to upload our work to GitHub? I saw some other lobsters posting links. If so, is there a place to register your repo once you upload it?
It’s up to you if you do or not, I like to for archival’s sake. I don’t know of any central place to register your repo, but it can be useful for posting links to your solutions in discussions.
This was a thing a few years ago
https://github.com/a-red-christmas
Not sure who’s responsible for it now. I remember it being pretty clunky.
Simplest way to share code is probably to stick a link in ones lobste.rs bio and let people know that way.
I’ve personally set up a bunch of scripts that allow me to make short blog posts for each entry and stick them in one place: http://gerikson.com/blog/comp/Advent-of-Code-2020.html
There’s no requirement to upload your work. But feel free to share it somewhere if you like!
If you log in to adventofcode.com with github, you can choose to let it link to your github profile.
No option for sr.ht :(
Well, if they allow for the officially hosted sr.ht login then they might feel obligated to also support all self-hosted instances.
Yes indeed, though I was actually hoping for the ability to use any URL as my link, not to use my sr.ht login on AoC. I understand why this might lead to some ‘interesting’ links from the AoC, though!
It’s full, :-(
Check @ignaloidas’ comment.
Hey all, my solutions will be here: https://github.com/lindgrenj6/adventofcode_2020
I’m doing it in elixir this year, kind of fell off last year but going to attempt to do at least 2 weeks this year!
Thanks for stepping up. I’ve joined!
This is my first year doing it! I’m trying to use J. My only other experience with J is some Project Euler problems.
It’s fun thinking spatially and coming up with a concise solution, but this makes me realize how absolutely dependent I am on Google/StackOverflow to learn by example. There is some stuff out there for J, but compared to more popular languages it’s nothing. Even for simple things like “split a string on a multi-character delimiter” (I eventually found the built-in
splitstring
and theload 'regex'
library). I think it will get easier once I memorize more of NuVoc.I’m in!
Reposting @syn-ack’s text story because the merged story view doesn’t show it.
Please submit AoC links in comments here. As usual for story merging, we’ll do one story per week.
I’m still working on getting my blog together for it, but I’m doing all of the problems in COBOL on IBM i as a way to learn both COBOL and IBM i. It’s been relatively straightforward so far, but I expect things to get much trickier soon.
Once I get it published, the blog will be available at https://thequux.github.io
That sounds really interesting, I’d love to see COBOL in this sort of situation.
It’s published, along with the writeups for days 1 and 2.
That sounds really cool. I hope you manage to get it published. And even if it gets too tricky to keep going, saying why would be interesting.
If you’re not already planning to say so, I’d be interested to hear about the setup that lets you do this, too.
It’s published, along with the writeups for days 1 and 2.
And yes, I do plan a post in a day or two that’s more on how I actually got my hands on one of these mythical beasts (and you can too!)
Very nice. Thanks for taking all the time it must’ve required to write that.
My solutions are / will be at: https://github.com/joelgrus/advent2020
I also stream while I’m trying to solve the problems, those videos end up here: https://www.youtube.com/playlist?list=PLeDtc0GP5ICmVrjHJrIiDZFW_xr__Ifqk
I wrote a post about my solutions for day 1 and 2: https://jlelse.blog/dev/aoc-2020-day1-2
I will continue posting solutions to the dev section of my blog: https://jlelse.blog/dev
I’m using Clojure this year - check my solutions at https://github.com/st3fan/aoc/tree/master/2020/advent-of-code/src/advent_of_code
I’m trying out this year’s puzzles in OCaml: https://github.com/yawaramin/aoc2020/
This year trying not to worry about generality too much, and just solving the specific puzzle itself. Also trying to think up ways to avoid being ‘accidentally quadratic’. Not sure how long I can keep it up, but so far so good.
Thanks for putting this together! I joined. Looking forward to it.
I did question 1a, 3a and 3b without writing code, using brain, fingers, kakoune editor and calculator.
[Comment removed by author]
I’m not gonna try join a leaderboard, since I’m using the AoC to teach myself Rust.
https://github.com/offbyone/advent-of-code-2020 though, if anyone wants to watch a Python dev figure out this “Rust” thing :)
Wow! All y’all are impressively fast! I’m happy to not be last. :)
(That’s in reference to tonight’s scores. For readers from the future, this is the second night but the first that there are scores, since the first night’s scores were disqualified due to server capacity issues.)
Yeah…
https://lobste.rs/s/lgotqc/lobste_rs_advent_code_2020_private#c_zna0br
I’m seeing a market opportunity for AoC to sell access to larger leaderboards to organizations who are prepared to pay for them..
My day 3 in Haskell baby-talk. I’m really looking forward to when the wheels come off.
I’m solving mine with Emacs Lisp and literate programming: https://tildegit.org/acdw/aoc-2020/src/branch/main/aoc.org
Linking my 2020 AoC file (Clojure): https://github.com/neeasade/AdventOfCode/blob/master/src/aoc/2020.clj
Thanks, just joined. 2 hours to go!
Putting my words where my mouth is:
Because of the merged-threads, I’ll just be reyping to this comment.
I don’t think I’ll be writing about AoC, but I’m posting my code here: https://git.sr.ht/~zge/aoc20/tree/master/aoc20.cl. The way it looks, I’ll just be adding everyting into one file, to make re-using code easier.
I will be posting my solutions at https://gitlab.com/Lomanic/aoc, for the moment I used bash on Day 1 & 2 and Go+Python on Day 1 (to compare performances of the three nested loops as I didn’t optimize this solution at all).
The irc channel is a true gem! Great discussions.
I will be blogging on progress (and learning) on https://bulters.dev and code will be up on https://GitHub.com/bulters/aoc20
Good luck to all participants!
Thanks, joined as well.
Just joined! Every year I end up doing only a few of these but let’s see how it goes this year.
Well, I’m going to try this in Janet, and only do it on weekends: https://github.com/yumaikas/aoc2020