I was jumping around Reddit earlier this month and stumbled upon Advent of Code, a site created by Eric Wastl that has “small programming puzzles” for each day of the 25 days of Christmas. Like Project Euler, they are presented in such a way that you can solve them any which way you please. And, having attempted six of them so far, I can say that the challenges are good for a variety of skill levels.
I was delighted enough to jump right into the first puzzle and banged it out in some not-too-polished Ruby (spoiler alert). I think I got through part 1 of day 3 that first night (you see my work in this repo).
an advent calendar of coding puzzles https://t.co/Bl6ABS3Jkt pic.twitter.com/u49Zoy5ogM
— Sam Schlinkert (@sts10) December 11, 2015
I was feeling pretty good about my solutions until I found this subreddit dedicated to sharing solutions to the puzzles. There are all sorts of solutions posted in all different languages (some I’d never heard of). Most of the upvoted solutions were elegant and extremely short. For example, here’s a 3-line solution to day 5’s challenge in Ruby, a puzzle that took me 66 lines in the same language (though I’m giving myself points for using objects and, in some cases, writing tests for my code).
I am happy that my tweet about the site has about 70 retweets at this point– exciting to think that others found the puzzles thanks to me. One of my favorite retweets was this quote tweet from @KurtKamer:
Kids tried manually on paper, couldn't get past day 1. Now they want to try on a computer
❤️ it
#AdventCalendar https://t.co/SNKHcTmkG9
— Kurt Kumar (@KurtKumar) December 17, 2015
I feel like that’s a great way to get a taste of programming!
Anyway, if you’re so inclined, check out Advent of Code and check the subreddit if you get stuck! Note: I’m currently stuck on Day 6, which sounds kind of embarrassing after writing this whole post, but that’s how it goes sometimes!