I love adventofcode. I have a rule I follow now which makes it a lot more enjoyable: if I can't make headway on a problem after trying for a day or so, I'll use the subreddit to find a hint, and then usually that's enough to help me to the answer. Very occasionally I just completely cheat (often the pure math based questions).
I don't like missing out on the stars.... I mean it's the only way you get to see the awesome ascii art when you collect all 50 for the year.
Many thanks to Eric and team for what must be a huge effort to run such a fun programme.
Oh, the other thing I do: I don't even start until sometime in January :) far less stress and keeps the whole family much happier ;)
I'd like to remind everyone that it's totally okay to do the first 10-15 days and leave the really hard stuff to people who are smarter or maybe have more free time. The first few days will still be fun.
I'm checking out Elixir this year, because I write 95 % Ruby at work and I'm getting really intrigued by the functional stuff seeping into it.
It's also okay to just do the problems without the competitive aspect. I love competitions and all, but sure as hell I'm not waking up at 5AM for an entire month in the pursuit of internet points.
I really enjoy doing these problems in Elixir, but the fact that the default collection type is a linked list makes certain problems difficult. However, Erlang does have a fifo queue (a doubly linked list), which can be helpful and let's you practice some Erlang interop while you're at it. https://www.erlang.org/doc/man/queue.html
I have failed to finish a few times. Not necessarily because they get harder (tho that contributes), but because I go at the speed/time I'm willing to dedicate and once the new year hits I invariably lose interest
Also, you can be strategic, the weekend ones are built to be longer than the weekday ones, so there's still some fun to be had later on even if you get stuck.
I normally skip out on these things, but I've been wanting to learn Erlang for a few months now and this comment inspired me to go for it this year! It might not help with learning the OTP stuff, but even after finishing the first two challenges I feel my mind expanding (first time doing functional programming).
I respect that AoC gets very difficult and is for an audience that isn’t me.
But I love the format and what I’d enjoy is a similar project where the difficulty doesn’t really increase, but each day is a different problem domain. Breadth not depth.
For example, perhaps we start with some data processing from a file. Then answer some basic statistics question about the data. Then maybe some basic signal processing. We form an image. We transform the image. We play the image as audio. We break it into packets of some sort then share it on a “network.” We reassemble it. We build a state machine and pass it the reassembled data in some way. We discover some new output.
Etc. etc. culminating with some fun discovery that inside that original data was a secret code or whatever.
And instead of an intense challenge, we’ve just had a fun walk through an intro to two dozen subdomains of CS/sweng. You may not have immediately known the answer to each puzzle but you never felt lost.
I have been solving these since years, I find it a nice way of assessing a language and deep dive since it will cover lot of parts of what makes a language.
I have been porting my old solutions in other languages into Kotlin over the time, and will be again doing them in Kotlin. I find it a nice language for AOC since custom extensions and DSL possibilities, it has a good builtin libraries and you can always fallback on Java, even if it has some shortcomings.
Regarding the AOC per se, I take it as a fun daily challenge, I know I won't be able to be part of the top 100, at least I would with some luck during the first 3 days, and then.. nope, that's life, try not to be too competitive. Last year it took me 8 hours to solve day 20, but it's a game, you should have fun doing it (I had), if not people should stop.
However, I strive in trying to write pretty, compact, idiomatic and as functional as possible code, which means that sometimes I will write an ugly solution in 5 minutes, and will take an hour to make it beautiful.
Besides I like to read the story, I know plenty of friends who don't even read the adventures of Santa, they just solve the puzzle and that's it, they don't even know they saved Christmas :-D !
Like every year, I feel I'm being lured in by an overly easy day 1.
Then somewhere between day 10 and 15, there will be a steep increase in difficulty and I'll tap out for the year. Then come back to the puzzles over the course of the year and maybe knock out another one or two.
There are some plots [1] of the time taken for the first 100 solutions to part 1 (silver dot) and part 2 (gold dot). They're a good visual indication of the relative difficulty of each question and how the difficulty of the second part increases.
And for anyone celebrating the holidays day 10-15 tends to be where I find real life holiday planning/activities start to rapidly take over my free time. I'm certainly not going to miss out on eggnog with friends and family so I can solve a few extra AoC problems.
I personally don't mind, if I spend 10 days learning a new language and solving some problems I'm satisfied. I'm still very excited when AoC comes up every year!
Agreed - I did Day One by copy/pasting the input into a spreadsheet and calculating the answers in additional columns. I suspect I'll need to actually write code soon, though. And give up soon after that.
AoC is often used to learn a new programming language, but it can also be used to improve them—especially less established ones.
Theres a small community [0] of people who decided to try out Coalton [1], which is a Common Lisp DSL that has a strict, Haskell-like type system, and has strict evaluation (not lazy) semantics. Pattern matching, algebraic data types, all that jazz are supported directly in a Common Lisp environment.
For example, here is a function to read in the first problem's data, which makes use of the usual high order functions (map and filter), as well as currying (only one argument provided to /=, making it curried):
(declare read-aoc-data (Unit -> (List Integer)))
(define (read-aoc-data _)
"Read the data for problem 1."
(let ((data (fromSome "Couldn't read AOC1 data."
(read-file-into-string aoc1-input-file))))
(map parse-int-or-fail
(filter (/= "") (split-string #\Newline data)))))
Type annotations, as in any good ML, are optional (except when there are polymorphism bugs, like one found during AoC!). Unlike Haskell, purity isn't demanded.
There's a small contest [2] with all sorts of prizes for doing AoC in Coalton and contributing back to the project through tutorials, PRs, and bug reports.
I didn't know anything about AoC until just recently when I took a very brief look at the 2020 problems (but didn't deep-dive). I'm trying to find good problems that can help me learn SAT/SMT solvers, but there doesn't seem to be much out there. Anyone know how well-suited these are for AoC?
There's usually a lot of different solutions (including many in esoteric languages or code golfed) along with screencasts and visualizations to explain how they got there. I find that even when the puzzles are easy I still learn a lot from the community by seeing all the different ways to skin a cat!
One of the fascinating things is reading other people's solutions. You get wild extremes - from easy clean solutions that I would never think of to some very weird choices. Especially in the first few days when the puzzles are easier it's more of the latter - there are some extreme abuses of Python in today's solutions thread on reddit. I get that it works but I also hope that nobody I work with ever writes code that way. I assume it happens more with Python because beginners are more likely to use it and because it gives you so much flexibility.
On the flip side, it's a bit humbling to see people solving the difficult days extremely quickly or having very concise and elegant solutions.
I really enjoyed the early part of this last year, but I got to Day 19 and suddenly it became
"if you memorized some mathematical concepts and an obscure algorithm and also recognize that this exact algorithm is the only efficient solution to the problem then you can solve this in 5 seconds, otherwise it will never finish running with any other algorithm".
I immediately quit. I'm not doing these to prove I'm smarter than other people or memorized random math concepts, I'm doing this to practice writing code or to learn a new language.
Not sure if this is indicative of other years (This is the farthest I've persisted in the 3 I've tried) but it was EXTREMELY demotivating, and killed every desire to continue or to even try it again next year.
*EDIT*: Apologies, I was incorrect on the Day where this happened. It was actually Day 13, with the Chinese Remainder Theorem being the solution. I must have copy/pasted a solution in frustration and continued past that point. My mistake.
Interesting. I think one of the main benefits of AoC is it tends to teach you things. So I would have gotten stuck, read peoples answers on the subreddit the next day, and the problem would have stuck in my memory as one that taught me something new.
I also wouldn't consider knowing properties of the GCD to be a "random math concept". It shows up in a reasonably large number of contexts. For example, in public key cryptography. A specific case is that at one point someone realized they could just collect hundreds of millions of RSA public keys and crack low entropy ones by checking for common divisors. Doing this naively by checking each pair would have been very costly, but they used properties of the GCD to massively reduce the cost by pooling keys [1].
> if you memorized some mathematical concepts and an obscure algorithm and also recognize that this exact algorithm is the only efficient solution to the problem then you can solve this in 5 seconds, otherwise it will never finish running with any other algorithm
well that's just not true at all.
I had no idea WTF the Chinese Remainder Theorem was and just worked out the issue iteratively. All you had to know was that if you are trying to find some large number that is divisible by other prime numbers, the deltas between the candidates will be the product of the numbers.
as in, if you are trying to find a number that is divisible by both 37 and 41, you really just need to find numbers divisible by 1517.
I forget what the name for this mathematical concept is, but it's far less obscure than the CRT.
Does every problem need to be solvable by everyone?
Project Euler used to say something along the lines of "not everyone can solve every problem, and that's OK". Looks like they've removed that statement though. I remember encountering it early in my career and realizing some problems I cannot solve, even though others can.
I had the same feeling about https://projecteuler.net/ but PE is very clear about being math focused so that's on me.
I wish Advent of Code puzzles were strictly algorithm focused without relying on specifics of mathematics. Skipping puzzles is demotivating for the completionist in me that lacks time to re-read math books.
I see it as on opportunity to expose yourself to a bunch of things in mathematics and computer science. Also, I'm pretty sure that you could get to the solution you're referring to without knowing any number theory at all.
I was the same as you for a few minutes - I was demotivated and when I found out what was behind it I thought "huh I never learned this and I'm not sure how I would have ever learned this" and felt a little bit defeated. But then I read a little bit on the subreddit, read the wiki on CRT, put together a solution and moved on. It's meant to be a bit of fun, if you have to skip one challenge (or cut a couple corners) it's no big deal - you can always come back to it later :)
It can be demotivating if you check the number of people who solved it quicker you, but just pretend they all cheated off one really really smart person and you'll feel much better :D
I often find that part1 can be solved by most, but part2 sometimes needs a clever trick, experience or some knowledge. Doing only part1 or skipping some day is perfectly fine, though. So I don't really get your anger.
I actually like when it teaches me something new. If you get stuck you could always google for the concepts you need and learn of them, or go to the subreddit and get hints but still solve the programming part yourself.
AoC is one of my favorite events of the year. I find the puzzles to be much more approachable than things like Project Euler. I regularly credit my yearly participation for making me a better programmer.
I also do a daily writeup of my solution, which helps make sure I understand the problem and help others who are learning. I found it super rewarding last year, so I'm doing it again this year. They're in my GH repo. Here's today's: https://github.com/xavdid/advent-of-code/tree/main/solutions...
My big tip is that you probably don't need to worry about competing for the leaderboard (unless you really want to). Go at your own pace, don't stay up weird hours, and take a break.
I love Advent of Code. As I sit here trying to prepare for my next set of 'leet' interviews, I wish employers could switch over to this style of tech questions. Advent of Code requires good coding and problem solving skills. Leet coding requires you to memorize every operation for dozens of data structures like how to insert elements in a min heap.
( Insert elements at the end and swap with the parent until the tree is correctly ordered again. Good luck figuring this out in 20 minutes if you don't know it ahead of time. )
( Now prepare yourself to remember how to insert/delete/search for elements in every other data structure with any number of different qualifiers when it's not going to be obvious at the outset of the question what kind of data structure to use )
( Oh and make sure you've memorized the time and space complexity )
Advent of Code has become an annual tradition for me. I do wish that they would update their scoring in some way to prioritize something other than how quickly you can write up the solution every day at midnight when the question is released.
If you enjoy Advent of Code, be sure to check out their sponsors. Not only because their support helps make AoC possible but also because they often have their own coding challenges that can be a fun compliment to AoC itself.
Eric Wastl who makes Advent of Code also made the Synacor Challenge (https://challenge.synacor.com/) a bunch of years ago which is similar to the Intcode AOC problems and a lot of fun.
Anybody interested in getting a just-for-fun HN user leaderboard going? Here's my code: 194284-90c48b41
In the last couple years I usually stopped up after a few days when I didn't find the time to do one of the puzzles or got stuck with the Rust borow checker. Maybe having a leaderboard helps with the motivation to keep on going! :)
I was going to do something fun, but gimmicky and try to implement them all in like SPL/2100 on an emulator running RTE, but quickly found I'd end up spending the month learning the latter.
I've been trying to think I've something, else fun to do or maybe use a language I've been itching to try, like Ada, but I’m not sure any of the questions will be of a nature to let me utilize the strengths of that language and I fear it will all end up being really boring procedural algorithms. I can think of a ton of other gimmicky solutions, but none that are very fun.
I wish I could take a month off from my client obligations to jam on stuff like this. I always get started - make it a few rounds - and then get crushed by the pressure of everything else. These sorts of games are so fun with TDD. Red. Red. Red. Red. .... Green!
Anyone here currently on any kind of sabbatical to just decompress and learn new stuff?
[+] [-] patrickdavey|4 years ago|reply
I don't like missing out on the stars.... I mean it's the only way you get to see the awesome ascii art when you collect all 50 for the year.
Many thanks to Eric and team for what must be a huge effort to run such a fun programme.
Oh, the other thing I do: I don't even start until sometime in January :) far less stress and keeps the whole family much happier ;)
[+] [-] Toutouxc|4 years ago|reply
I'm checking out Elixir this year, because I write 95 % Ruby at work and I'm getting really intrigued by the functional stuff seeping into it.
[+] [-] qsort|4 years ago|reply
[+] [-] pablodavila|4 years ago|reply
[+] [-] regulation_d|4 years ago|reply
[+] [-] np_tedious|4 years ago|reply
Still enjoy whatever I get done
[+] [-] SketchySeaBeast|4 years ago|reply
[+] [-] Rendello|4 years ago|reply
[+] [-] dimgl|4 years ago|reply
[+] [-] TrueDuality|4 years ago|reply
[+] [-] thanksfortherem|4 years ago|reply
[deleted]
[+] [-] Waterluvian|4 years ago|reply
But I love the format and what I’d enjoy is a similar project where the difficulty doesn’t really increase, but each day is a different problem domain. Breadth not depth.
For example, perhaps we start with some data processing from a file. Then answer some basic statistics question about the data. Then maybe some basic signal processing. We form an image. We transform the image. We play the image as audio. We break it into packets of some sort then share it on a “network.” We reassemble it. We build a state machine and pass it the reassembled data in some way. We discover some new output.
Etc. etc. culminating with some fun discovery that inside that original data was a secret code or whatever.
And instead of an intense challenge, we’ve just had a fun walk through an intro to two dozen subdomains of CS/sweng. You may not have immediately known the answer to each puzzle but you never felt lost.
[+] [-] flaie|4 years ago|reply
I have been porting my old solutions in other languages into Kotlin over the time, and will be again doing them in Kotlin. I find it a nice language for AOC since custom extensions and DSL possibilities, it has a good builtin libraries and you can always fallback on Java, even if it has some shortcomings.
Regarding the AOC per se, I take it as a fun daily challenge, I know I won't be able to be part of the top 100, at least I would with some luck during the first 3 days, and then.. nope, that's life, try not to be too competitive. Last year it took me 8 hours to solve day 20, but it's a game, you should have fun doing it (I had), if not people should stop.
However, I strive in trying to write pretty, compact, idiomatic and as functional as possible code, which means that sometimes I will write an ugly solution in 5 minutes, and will take an hour to make it beautiful.
Besides I like to read the story, I know plenty of friends who don't even read the adventures of Santa, they just solve the puzzle and that's it, they don't even know they saved Christmas :-D !
[+] [-] LandR|4 years ago|reply
Then somewhere between day 10 and 15, there will be a steep increase in difficulty and I'll tap out for the year. Then come back to the puzzles over the course of the year and maybe knock out another one or two.
[+] [-] bhrgunatha|4 years ago|reply
[1] http://www.maurits.vdschee.nl/scatterplot/
[+] [-] time_to_smile|4 years ago|reply
I personally don't mind, if I spend 10 days learning a new language and solving some problems I'm satisfied. I'm still very excited when AoC comes up every year!
[+] [-] codingdave|4 years ago|reply
[+] [-] SketchySeaBeast|4 years ago|reply
[+] [-] reikonomusha|4 years ago|reply
Theres a small community [0] of people who decided to try out Coalton [1], which is a Common Lisp DSL that has a strict, Haskell-like type system, and has strict evaluation (not lazy) semantics. Pattern matching, algebraic data types, all that jazz are supported directly in a Common Lisp environment.
For example, here is a function to read in the first problem's data, which makes use of the usual high order functions (map and filter), as well as currying (only one argument provided to /=, making it curried):
Type annotations, as in any good ML, are optional (except when there are polymorphism bugs, like one found during AoC!). Unlike Haskell, purity isn't demanded.There's a small contest [2] with all sorts of prizes for doing AoC in Coalton and contributing back to the project through tutorials, PRs, and bug reports.
[0] They hang out on Discord https://discord.gg/cPb6Bc4xAH
[1] https://github.com/coalton-lang/coalton
[2] https://coalton-lang.github.io/20211129-aoc-contest/
[+] [-] mynameisash|4 years ago|reply
[+] [-] dunefox|4 years ago|reply
[+] [-] uyt|4 years ago|reply
There's usually a lot of different solutions (including many in esoteric languages or code golfed) along with screencasts and visualizations to explain how they got there. I find that even when the puzzles are easy I still learn a lot from the community by seeing all the different ways to skin a cat!
[+] [-] jstx1|4 years ago|reply
On the flip side, it's a bit humbling to see people solving the difficult days extremely quickly or having very concise and elegant solutions.
[+] [-] bussierem|4 years ago|reply
"if you memorized some mathematical concepts and an obscure algorithm and also recognize that this exact algorithm is the only efficient solution to the problem then you can solve this in 5 seconds, otherwise it will never finish running with any other algorithm".
I immediately quit. I'm not doing these to prove I'm smarter than other people or memorized random math concepts, I'm doing this to practice writing code or to learn a new language.
Not sure if this is indicative of other years (This is the farthest I've persisted in the 3 I've tried) but it was EXTREMELY demotivating, and killed every desire to continue or to even try it again next year.
*EDIT*: Apologies, I was incorrect on the Day where this happened. It was actually Day 13, with the Chinese Remainder Theorem being the solution. I must have copy/pasted a solution in frustration and continued past that point. My mistake.
[+] [-] Strilanc|4 years ago|reply
I also wouldn't consider knowing properties of the GCD to be a "random math concept". It shows up in a reasonably large number of contexts. For example, in public key cryptography. A specific case is that at one point someone realized they could just collect hundreds of millions of RSA public keys and crack low entropy ones by checking for common divisors. Doing this naively by checking each pair would have been very costly, but they used properties of the GCD to massively reduce the cost by pooling keys [1].
[1]: Page 7 of https://www.quintessencelabs.com/wp-content/uploads/2020/03/...
[+] [-] justinsaccount|4 years ago|reply
well that's just not true at all.
I had no idea WTF the Chinese Remainder Theorem was and just worked out the issue iteratively. All you had to know was that if you are trying to find some large number that is divisible by other prime numbers, the deltas between the candidates will be the product of the numbers.
as in, if you are trying to find a number that is divisible by both 37 and 41, you really just need to find numbers divisible by 1517.
I forget what the name for this mathematical concept is, but it's far less obscure than the CRT.
[+] [-] Buttons840|4 years ago|reply
Project Euler used to say something along the lines of "not everyone can solve every problem, and that's OK". Looks like they've removed that statement though. I remember encountering it early in my career and realizing some problems I cannot solve, even though others can.
[+] [-] hu3|4 years ago|reply
I wish Advent of Code puzzles were strictly algorithm focused without relying on specifics of mathematics. Skipping puzzles is demotivating for the completionist in me that lacks time to re-read math books.
[+] [-] jstx1|4 years ago|reply
[+] [-] smcl|4 years ago|reply
It can be demotivating if you check the number of people who solved it quicker you, but just pretend they all cheated off one really really smart person and you'll feel much better :D
[+] [-] Strilanc|4 years ago|reply
[1]: https://adventofcode.com/2020 shows the number order
[+] [-] tyingq|4 years ago|reply
I didn't read it in depth, but it feels like you could build regexes on the fly to solve it. Perhaps I missed something crucial.
Edit: Ahh, day 13: https://adventofcode.com/2020/day/13
[+] [-] matsemann|4 years ago|reply
I actually like when it teaches me something new. If you get stuck you could always google for the concepts you need and learn of them, or go to the subreddit and get hints but still solve the programming part yourself.
[+] [-] LandR|4 years ago|reply
Part 1 runs in ~0.5 msecs Part 2 runs in ~2 msecs
[+] [-] Xavdidtheshadow|4 years ago|reply
I also do a daily writeup of my solution, which helps make sure I understand the problem and help others who are learning. I found it super rewarding last year, so I'm doing it again this year. They're in my GH repo. Here's today's: https://github.com/xavdid/advent-of-code/tree/main/solutions...
My big tip is that you probably don't need to worry about competing for the leaderboard (unless you really want to). Go at your own pace, don't stay up weird hours, and take a break.
[+] [-] nineplay|4 years ago|reply
( Insert elements at the end and swap with the parent until the tree is correctly ordered again. Good luck figuring this out in 20 minutes if you don't know it ahead of time. )
( Now prepare yourself to remember how to insert/delete/search for elements in every other data structure with any number of different qualifiers when it's not going to be obvious at the outset of the question what kind of data structure to use )
( Oh and make sure you've memorized the time and space complexity )
( Not that I'm bitter or anything )
[+] [-] paxys|4 years ago|reply
[+] [-] Mountain_Skies|4 years ago|reply
[+] [-] Barrin92|4 years ago|reply
[+] [-] w-m|4 years ago|reply
In the last couple years I usually stopped up after a few days when I didn't find the time to do one of the puzzles or got stuck with the Rust borow checker. Maybe having a leaderboard helps with the motivation to keep on going! :)
[+] [-] gmfawcett|4 years ago|reply
[+] [-] akpa1|4 years ago|reply
Personally, joining leaderboards like this certainly help with motivation, though I couldn't say why.
[+] [-] Cyphase|4 years ago|reply
[+] [-] the_only_law|4 years ago|reply
[+] [-] tester34|4 years ago|reply
F#, Lisp and so on
[+] [-] whalesalad|4 years ago|reply
Anyone here currently on any kind of sabbatical to just decompress and learn new stuff?
[+] [-] joshgrib|4 years ago|reply
[+] [-] zora_goron|4 years ago|reply
[+] [-] timvisee|4 years ago|reply
[+] [-] briffle|4 years ago|reply
Its great for those of us on the more OPS side of DEVOPS:
https://sysadvent.blogspot.com/