Skip to content

Advent of Code 2020, 50 programming puzzles in 25 languages

Notifications You must be signed in to change notification settings

softrabbit/aoc2020

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

https://adventofcode.com/2020, "Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like."

I got a slow start as I didn't even know about this until the 9th, but these nevertheless seem like some fun puzzles to fill downtime with. I totally tip my hat to the people that day after day show up in the leaderboards with solutions in like 2 minutes after the puzzle has gone public. I can barely read through them in that time, let alone code a correct implementation! Not the mention the unpredictable nature of when I get to squeeze in some coding time...

So I decided to try a different path, for me it's not about speed; I'll try to get a good spread of programming languages instead, maybe even a few I honestly could say I don't know. Which means that many of the solutions will be not quite the elegant (and often cryptic) ones an expert in the language would write, and not too optimal either. But by the time I commit them, they're usually correct for the task at hand. If something bugs me too much, I might revisit it later...

Day Language
1 JavaScript Finding simple sums wasn't too bad, even if I'm not quite an expert in JS. (I started with languages I have at least some experience in.)
2 AWK Checking strings for various criteria sounds like the realm of text processing languages.
3 FreeBasic BASIC was my first language back in 198x, and this almost looks like a game I could've written at 12. In this episode I learned that output is glacially slow in the native Windows console.
4 PHP One of the few languages I've used professionally. Just right for validating data fields.
5 C Binary numbers from strings, not a bad match for the language.
6 Python Sometimes it sure helps if there is a set datatype available. This would probably have been so much longer in C.
7 Java Not a language I've crossed paths with much since 1996, but occasionally it happens. A 2-way acyclic graph implemented, but holy heck how many lines I use just for the parsing the input! [:thumbs_down:]
8 Perl My code doesn't look like line noise, that's because I don't know Perl well enough. Maybe I write PHP in all languages, not necessarily a good thing.
9 Pascal Ah, Turbo Pascal pirated on 5.25" floppies... those were the days. Writing a linked list felt kinda nice, even if it's been a while. Not a bad language, really.
And this is where I ran out of languages and had to go out into the uncharted waters of Schitt Creek. With several paddles, large outboard motor and plenty of gasoline but not much of a map or GPS. Fun!
10 Ruby Wasn't this a trendy thing a little while back? Nevertheless, doesn't feel too different from most languages I know even if the syntax is somewhat different. Didn't dive into the OO side of it, though. Traversing a list and a graph didn't require that.
11 Godot Not bad for a tool with so much depth in it. For problem solving, the event driven model isn't always optimal but you sure can make your Game of Life-ish thing pretty.
12 Clojure Following navigation instructions using functional programming... Didn't quite figure out the intricacies of lists and arrays and how you can pass them on to the next function. Good thing there are variables, too. Java (JVM? Who knows) sticking its paw into the compilation process made for some confusing error messages. The code doesn't look too cryptic a few days later, which I count as a win.
13 Scala Error messages sometimes even confusinger than Clojure, again I blame the layer cake architecture. Probably not a language you pick up too easily, maybe because it looks too familiar but really isn't? Had a pretty bad algorithm for synchronizing cycles, but left it running all day and it had produced an answer when I came back to improve the code... so I put that away for later.
14 Dart Bit juggling. Way faster compiler and more helpful error messages than in the previous two cases. Which is very nice when stumbling into solutions.
15 C++ Number sequence from a simple rule. Calculate and stuff into a std::map or equivalent.
16 Go Just like an improved C, I guess. Still making things long and cumbersome, but in a safer way.
17 TBD
18 TBD
19 TBD
20 TBD
21 TBD
22 TBD
23 TBD
24 TBD
25 TBD

About

Advent of Code 2020, 50 programming puzzles in 25 languages

Resources

Stars

Watchers

Forks