Hacker News new | past | comments | ask | show | jobs | submit login
Advent of Code 2017 (adventofcode.com)
389 points by djsumdog on Nov 30, 2017 | hide | past | favorite | 76 comments



Advent of Code is an amazing achievement. Designing all the puzzles, writing code to generate all those different inputs for everyone, keeping the site going, somehow managing to create this wonderful community of problem solvers... I loved it last year. I've already paid my AoC++ this year. The least I can do for a month and more (because I never do a puzzle a day, and still haven't finished last year's) of fun.

This year I need to make sure I do the graph search problems properly, because I've never learned those methods and I really should.


Likewise, on the graph search problems and paying the AoC++ contribution early.

I don't know how Eric Wastl manages this each year but I've been participating the last two years and it's ridiculously fun!


> This year I need to make sure I do the graph search problems properly

I'm guessing this year it might be some other 'common theme' for the tasks, and we might not see as many graph-problems as in 2016.

But learning graph searches cannot hurt you either way :)


Are there any good resources you'd recommend on learning how to effectively work with/search graphs?


https://www.redblobgames.com/ has a great A* intro with visualizations and code. I highly recommend it.


This would be my reply too. The whole site is great! I've recently went through hex grid tutorial - very informative, interactive and nicely presented.


Great link, thanks for sharing!


If you want some Graph Theory challenges to solve there is a track at HackeRank

https://www.hackerrank.com/domains/algorithms/graph-theory


Robert Sedgewicks Algorithms II on Coursera covers a few graph search techniques


In that case I hope he ditches assembly instead :)


Since Peter Norvig has been topical this week, here are his great instructional ipython notebook solutions to last years AoC challenges[1].

[1] http://nbviewer.jupyter.org/url/norvig.com/ipython/Advent%20...


This was an incredibly satisfying format for this. Cool!


I'll have to come by again tomorrow, but I must say the design of the site is beautiful. The content is immediately clear, and as you look closer it's clear that the author put some very subtle design touches on, but they aren't overwhelming.

Well done!


Indeed, Advent of Code is easily one of the best computer games.


I'm doing it this year. In D, because I'm stubborn, enjoy the language, and couldn't immediately get to like Rust.

Going by hype, I have a feeling learning Rust will some day be as inevitable as interacting with git, but for the moment I'm sticking to D.


That remains to be seen, but I firmly believe you should do AoC in something you enjoy!


First attempt at doing it in Racket this year. I actually got through a bunch just using R last year.


Out of curiosity, what do you enjoy about D?


It's essentially the C++ I always wanted, which is more or less its intent.

It's fast. The D code I write routinely matches or outperforms the C++ I also write for comparison.

D is a much cleaner language. It has obvious C++ inspirations but has thrown out decades of backwards-compatible cruft.

As a result, D has some of C++'s best features, like sophisticated metaprogramming, with much nicer language. In fact, this is the part I like the most: compile-time function evaluation. D allows you to evaluate essentially any function at compile time for which all of its inputs are known at compile time. It almost feels like lisp macros, with the slight downside that they work on unstructured strings instead of (minimally) structured sexps.

D is safe. It produces stack traces when I mess up instead of segfaults. It won't let me compile the most obvious errors it can catch at compile time. I'm not even sure yet if it's possible to have UB in D.

D is flexible. It doesn't impose an opinion on how I should do things. I can do OOP, functional, or procedural as I please and provides useful tools to do all those. OOP is like the familiar classes you know from C++ and Java with interfaces instead of multiple inheritance. Functional programming utilities are useful without being burdensome. You can totally do a for loop in a pure functional function as long as the overall function has no side effects, which is very practical.

D has a bunch of other niceties which you can explore in the D's gems section here:

https://tour.dlang.org/tour/en/gems/uniform-function-call-sy...


Thanks for this. I only just read it :)

I'm actually one of the core devs of Nim and so probably naturally your description of D sounds a lot like a description of Nim to me. You should check it out if you haven't already.


AoC is lots of fun. There's an active community on http://reddit.com/r/adventofcode where people share tips and help each other out.

I highly recommend participating. AoC is designed as a speed coding competition, but if you aren't playing for the speed points, it's a fun way to learn a new programming language.


It's really not designed as a speed coding competition; that's just what it became by accident. Eric built the first edition for friends and friends of friends, expecting maybe 70 people to participate. He thought a 100 person leaderboard would be more than enough. The look on his face the next day when he realized what had happened and that his infrastructure wasn't going to hold up was priceless :)

That said, it is a fun way to learn a new programming language or to brush up on one you haven't used in a while. Stop by the subreddit and get help if you're having trouble or give some help if you're able!


> If you're curious about how Advent of Code works, it's running on some custom Perl code.

Get out! Here I was thinking I was the only person using Perl in 2017.


Shhhh! You'll get lynched talkin' like that around here.


The perfect excuse I was looking for to finally start digging into Elixir. ;)


Elixir is my plan for advent of code also. Haven't tried it before, but it looks fun!


Thanks for the idea, I'm definitely going to do this as well!


I love AoC! Last year was the first time I got all 50 stars, as I was motivated by a competition held by a Swedish podcast. This year, I'm even hosting a pub meetup about halfway through December, centered around Advent of Code, where a group of us hopefully can help each other out.


Both the podcast and pub meetup seems interesting. Do you have some more information?


While I enjoy advent of code I always have been happy to live on the west coast. I wonder how many people on the east coast don't participate because they'd have to stay up til midnight if they want to score.


It could be fun if each puzzle were unlocked after 23h (or 25h). I.e. the start time shifts everyday by 1h to make it "fair" no matter what timezone you live in.


As a moderator on the subreddit and coworker of Eric Wastl, that'll never happen because we would die. It's set up so that puzzles unlock at a time that Eric is awake and able to respond to any issues that may arise.


I think there's value in completely ignoring the race.

I'm probably going to do this either in a language I'm learning as I go, or in something like Erlang which, whilst great to get correct, will not iterate as fast (for me at least) as the Ruby solution I could quickly and easily write.


You mean, each entry doesn't get revealed at 6am as it does here in Europe?


I'm so glad I'll be able to participate before work, and not before sleep :)


How does the scoring work? Is it dependent on speed? Are you penalised for incorrect attempts? What time / timezone are the problems released?


Problems are released midnight EST. First person with a solution globally gets 100 points, second person gets 99, etc. So you have to be one of the first solvers globally to get any points.


If you feel the global challenge is out of reach, you can setup a private leaderboard for you and anyone you give the 'join code' to, localizing competition and points to your own circle of "AoC" friends: http://adventofcode.com/2017/leaderboard/private


So, what are people gonna work in? Anything interesting? I am myself thinking about doing the challanges in Powershell. Because why not suffer more on this earth.


I'm thinking on doing them in Rust and Clojure. I've dabbled in Clojure before but nothing serious and I'd like to build up some more familiarity. Rust because it's the first systems programming language that grabbed my attention; plus it's always good to have a varied selection of tools in your proverbial toolbox.

I know that I can probably do them in 10 minutes in Python, but that's not going to be as fun or valuable, especially since I'm not going to be able to compete for the leaderboard due to timezone/work.


> I know that I can probably do them in 10 minutes in Python

Then you are in the absolute top tier of the people competing. Either that, or you probably belong in this subreddit https://reddit.com/r/iamverysmart ;)


Haha, I meant the actual coding part. I'm sure the problem solving would take me longer, it's just that once I have a solution in mind I can code it in 10 minutes in Python, since I'm very familiar with it and use it almost on a daily basis.

Having to think about basic things such as how to instantiate hash maps, what is the syntax for control flow, does this language have this particular functionality. This can take hours spent in reading documentation and debugging.

From what I've seen from last year, the problems arent't that hard (they're meant to be solved within a day), so the real time consuming part is the coding.


I get what you mean, but after the few first days it gets kinda hard imo. It takes like 10 minutes for me to read and maybe grep what the problem is.


> Anything interesting?

Couple months ago I discovered Nim [1], which I find as an interesting language, and I just finished 2015's tasks as a practice [2].

Now I'm considering using it for this year too. I'll use Python as a fallback, if/when I fail to complete some task in Nim.

[1] https://nim-lang.org/

[2] https://github.com/narimiran/advent_of_code_2015


Moving from Python 2 to Python 3. I sort of debated learning something new, like Haskell. But I want to be competitive, and that means language familiarity.


I'm challenging myself to use a different language every day. But I've already blown too many good languages; need to save some for the end (assuming the problems get harder).


Powershell seems fitting. Advent is a penitential season after all.


I'm trying racket.


Is it a death sentence to try and learn Haskell on this challenge? Or should I go with a language I'm more comfortable in?


No. What's the worst that happens? You take longer to do the challenges?

The leaderboard is irrelevant, as you can only get on it if you're in the right time zone/nocturnal/unemployed and really really fast, so what you then get out of it is a solid set of Haskell problem-solving skills.

People learn languages in AoC every year. Do it!

Some people do each day in a different language. Maybe don't do that...


I went into ICFP 2007 with two other dudes, only one of us knew Haskell (not me), and yes, it was a death sentence.

However, ICFP is 4 days, not a month, and the experience was good enough that it made me want to actually learn Haskell properly. I had fun and benefited in the long run. :)


I was most of the way through last year's in C# when I decided now was the time to properly learn (algorithmic programming in) Elixir. That set me back in terms of speed, but it was well worth it. I'm now fairly fluent and I'm doing this year's in Elixir from the start, so - yes, it's a great way to get into a language, I would say.


I used last year to learn Elm really well and plan on using this year for F#. Go for it!

Elm served as a gentle intro to Haskell for me personally since it has easier to read errors and less overall complexity to grok at first go, but it sort of depends on your experience.


Well, I've used previous challenges to learn/improve my Nim. And I can tell you, after solving whole 2015 challenge - my Nim skills have noticeably improved.

Would recommend AoC as a learning tool.


I found Project Euler really helpful for learning new languages, I imagine AoC is similar.


Though I find Project Euler to be pretty heavy on the math problem solving, and not much on the day-to-day programming problem solving.


I agree with you. Not super useful for day to day stuff, but still fun and enlightening.


just do it, what's the worst that could happen?


ReasonML this year, or that's the plan. Excited for it!


The about page doesn't say: is there a specific language used for these?


There isn't, by design. You write _some_ black-box implementation locally which outputs a textual solution you drop into the browser (at least, this is how it was in 2015 when AoC started).

I can't recommend this enough. I had to miss out on last year's challenges, but planning on participating this year; it's a great way to keep your brain nimble if you feel like you're in a rut.


The prior events are still available! http://adventofcode.com/2016 and http://adventofcode.com/2015


Nope! All of the answers boil down to some simple text input, so you can run whatever code you want locally to get the answer.


> is there a specific language used for these?

There isn't. Some previous tasks could be solved by pen-and-paper, or by using your browser's search on the input, etc.

Also, there were some users who solved each day in a different programming language.


I haven't done AoC before. Does anyone know if it's possible to submit 2 solutions? I want to use this to brush up on my Python, and I want to start digging into Rust.


AoC is language agnostic. You can find previous years' puzzle and give it a shot.

https://adventofcode.com/2017/events


Thanks.


Last year I solved most problems the first time through using Perl and then later came back and used it to try to learn Rust. The second time through I started by writing test cases using the known-good answer from the Perl implementation.


You get a unique input generated per puzzle, and then you submit the output your solution generates.


FYI: I plan to publish a Ruby Advent Calendar 2017 - 25 Days of Ruby Gems / Libraries, December 1 - December 25 @ https://planetruby.github.io/advent2017 Sneek preview of day 1 - https://planetruby.github.io/advent2017/01-blockchain-lite


I had lots of fun with AoC in 2015 and 2016. Here are my (Go) solutions: https://github.com/lukechampine/advent

There is also a subreddit (/r/adventofcode) if you get stuck and/or need inspiration. Some really creative solutions there.

Best of luck to everyone this year. See you on the scoreboard! :)


I do codejam every year. Looks fun, will participate. First impressions tell me that runtime complexity won't as strict here however


Have really enjoyed this the last couple years! Wish that this would open at a more reasonable time for the east coast folks.


It took me a while to figure out this wasn't an article outlining a new way of coding starting in 2017.


Currently working through this and last year in Perl 6. Really good fun.


As a first time visitor, I find the design very clear and readable.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: