Advent of Code
A set of solutions for Advent of Code puzzles in a myriad of different programming languages with different paradigms in order to improve myself and train myself on more options.
Published onUpdated on
2.18
Description
Advent of Code is an annual event where users are
given a series of programming challenges to solve, all courtesy of Eric Wastl.
I just want to use multiple languages and have fun solving it. My goal for all
years is 30/50 stars.
By the way, the difficulty is how I feel. It’s not a real metric. I’m just a beginner programmer (at the time of writing, I started around 2023). How I consider it:
- Easy: simple and straightforward, usually brute-force with no optimization.
- Medium: difficulties in parsing, solving, etc. Usually requires some optimization.
- Hard: requires more knowledge, more optimization, and realizing the core of the problem. Usually a brute-force solution won’t work.
- Very Hard: requires some obscure algorithmic knowledge. I probably won’t be able to do this. Even if I could, this could very well be a blogpost on its own.
- Brutal: even if I know the solution, I probably can’t even implement it.
For an overview of what challenges I have completed, you can view the repository README yourself. This document only aims to provide interesting insights into a few programming languages I wrote.
The Differences in Paradigms
We all know and love Object-Oriented Programming (OOP for short), but there are a lot more paradigms, and knowing how to at least apply them for basic algorithmic problems probably would help.
Since I learned a few paradigms, sometimes I try to apply those ways of thinking into problems in OOP languages, and some of them do support those kinds of solutions, for example like Java Streams API! Modern languages now do implement a lot of features, borrowing from other paradigms!
You can imagine paradigms like an iceberg:
- Object-Oriented Programming (OOP): The core of this paradigm is mutable objects, objects do something with their data, and mutate themselves. Key concepts of this paradigm include inheritance, encapsulation and indirection. Example languages: Java, C#, Python.
- Functional Programming (FP): It has been getting a foothold in recent time, here, functions are first-class objects. They can be passed around like data. Some key concepts include pure functions, immutability, pipelining and the separation between the real world (dirty IO) and the pure world. Example languages include: Haskell, Julia, Elixir.
- Procedural Programming (PP): The original way of programming. Functions are usually unscoped, global and data is passed in parameters as arguments. Example languages include: C, Assembly.
- Array-Oriented Programming (AP): An unpopular style of programming where
native data types include n-dimensional arrays and boxing/unboxing them around.
Sounds very unintuitive, but it is one of the building blocks for
numpy, the most important invention for Pythonic Data Science. Example languages include: APL, Uiua.
You can view how a problem can be solved in four different paradigms here.