Ho! Ho! Ho! An Advent Calendar of Puzzles
December is here, and the run up to Christmas has well and truly started. Mince pies are mincing, mulled wine is mulling and Advent calendars the world over are already taking a battering.
For those of us who love solving puzzles, Eric Wastl has put together something special: an online advent calendar that dishes out a new puzzle to solve every day!
The Advent of Code releases a new puzzle each day in December up until Christmas Day.
Every puzzle is Christmas themed (help Santa deliver presents, help the elves wrap the presents at the North Pole etc).
You can theoretically solve them by hand but the intention is to use a programming language of your choice to come up with the answers and you probably want to as the puzzle inputs are pretty large.
Santa is trying to deliver presents in a large apartment building, but he can’t find the right floor — the directions he got are a little confusing. He starts on the ground floor (floor 0) and then follows the instructions one character at a time.
An opening parenthesis, (, means he should go up one floor, and a closing parenthesis, ), means he should go down one floor.
The apartment building is very tall, and the basement is very deep; he will never find the top or bottom floors.
(()) and ()() both result in floor 0.
((( and (()(()( both result in floor 3.
))((((( also results in floor 3.
()) and ))( both result in floor -1 (the first basement level).
))) and )())()) both result in floor -3.
To what floor do the instructions take Santa?
We’re only on day 2 and I’ve already had a blast solving them with Ruby. My solutions are over on Github and I’ll be updating them each day as we go through December.