Monday, 30 December 2013

Christmas Puzzles

The family coffee table this Christmas saw many retro toys and puzzles come and go across it's veneered wooden top; table-top crazy golf, rubber band cars, a plastic miniature Connect Four and even a couple of Transformers Robots with realistic firing missile launcher bits!

Tetris jigsaw, and, if you look closely - PacMan Socks!
Particularly exciting in my Christmas present pile was an official Tetris jigsaw puzzle.  One hundred cardboard pieces of rainbow-coloured tentromino shaped fun.  It'd been ages since I'd last done anything approaching a real jigsaw puzzle, often a Christmas cracker would contain a small token effort, but they are always a disappointment, so to have a medium-sized bite of an incredibly intricate pattern of tiled pieces was the perfect start to my Christmas morning.  I managed to get my organisational skills into place, first identifying corners and constructing edges. Then, upon spotting that there were only two types of non-edge piece, quickly categorised the remainder and could work my way in from the outside.  The puzzle was quickly solved, though some patience was required to match up the colours on the tabs and surrounding the blanks. But, as the number of pieces put into place became greater, and the time to hunt became less, the gaps became smaller, the picture clearer, until finally the puzzle was completed with a jubilant and resounding "done!".  Then the Smirnoff vodka-flavoured chocolate truffles were started in celebration.

A family Christmas wouldn't be a family Christmas without my brother and I wading through some of the latest video-game releases.  Between Assassin-pirate pilfering, heist holding hooliganism, Roman risen revenge and zombie apocalypse antics you would think there to be little time for much else.  Except a rather nice puzzle game named Fez that, despite my best efforts, took up a rather large chunk of my holiday time.  We'd recently watched "Indie Game: The Movie", in which the development of the game features heavily, and where curious about what it actually entailed.   Running around a 2D-3D puzzle world searching for yellow cubes mostly.  The puzzle element of the main game was entertaining, with a particularly nice art style and some really stunning mind-bending puzzle/lateral thinking/realisation moments.  However the game also featured it's own set of meta-game puzzles, necessary to find the blue "anti-cubes".  As a child I would have loved transcribing and translating the in-game language to solve these elaborate puzzles. Unfortunately now, as a time limited, cynical adult, I could appreciate their beauty, depth and execution, and could also reflect on the fact that I no longer have to have solved said puzzles by myself (or call up some extortionate tips hot-line while my parent's weren't looking), because there's a million YouTube videos and web-based walk-throughs to save me from having to work out things that "I know how to work it out, but guess what, I don't need to!".

Finally, there was one other puzzle that occupied a lot of my time.  To go with the plastic miniature Connect Four, there was also a mini Draughts, Chinese Checkers and, most interesting to me, English Peg Solitaire.  I spent quite a few hours click-tap-clicking away at the pieces of this latter game, trying to understand the patterns and the dance the pegs and holes could form.  Eventually I realised that it'd require a fair amount of thought (or days of trial and error) to get to a solution.  Plus, I think I was starting to drive my family mad with the constant click-tap-click-tap-click, "oh grrr" coming from the sofa.  So, on Christmas day, after finishing the jigsaw (and celebratory vodka-truffles), I broke out the laptop and knocked up some code to find and then draw out step-by-step instructions.  Once followed and the game solved, I did a bit of reading up on Wikipedia, the problem has a lot of interesting properties including memonics for helping to remember a nice solution based around composite moves.

My step-by-step graphical solution follows, though it's not an intelligent or minimized one, just the first that my naive solving algorithm spat out.  The Haskell code to do this is on-line for the really interested.