Can You Solve GCHQ Xmas Puzzle?
Written by Mike James   
Wednesday, 23 December 2015

It seems that government security agencies like to set puzzles for us geeks to solve. The motive might be recruitment, but it is still fun trying to solve them even if you don't want a job as a spook. 


This year the UK communications agency GCHQ has been sending a "traditional" xmas card from the director that includes a not so traditional puzzle. If you can solve the puzzle it leads on to other puzzles:

"Once all stages have been unlocked and completed successfully, players are invited to submit their answer via a given GCHQ email address by 31 January 2016. The winner will then be drawn from all the successful entries and notified soon after."


The card, which also asks for donations to the UK children's charity NSPCC, is only being sent out to people on the director's xmas card list, but the rest of us can access the puzzle on the website. 

The problem is an interesting one as it takes the form of an inverse, or tomographic, reconstruction. Such puzzles are reasonably well known and Wikipedia suggests that they are called Nonograms, Hanjie, Picross or Griddlers. 

The basic idea is that you have a 2D grid and along the rows and columns are lists of numbers that give how many runs of each length there are in the row and column. For example a row with 2, 4, 5 next to it would have three runs consisting of a run of 2, a run of 4 and a run of 5 black cells. Obviously a single row or column doesn't specify where the runs are but if you are given the information for all of the rows and columns you can see that a unique solution which satisfies all of the constraints might exist. If a unique solution doesn't exist then you can fix which one you want by providing some of the starting values. 

Notice that this is similar to the inverse problem encountered in tomography where you can measure the absorption of a beam, usually X-rays, in a range of positions and have to work out the 2D arrangement of absorbers that could produce the pattern. 

The GCHQ problem can be seen below:



Before you start to ponder the problem manually I should point out that there are some fairly obvious programming approaches to the task, but you already knew that didn't you.

When you get it right the image is a QR code that leads you to the second part, which is a sequence of multiple choice questions.

So start coding and see what you can come up with. 


More Information

A Christmas card with a cryptographic twist

Related Articles

GCHQ Open Sources Gaffer 

UK Launches Games Portal To Discover Cyber Security Talent 

Alan Turing Institute Starts Work 

GCHQ Builds A Raspberry Pi Cluster 

Cryptoy - Code-Making App From GCHQ 

GCHQ Challenges Hackers To Crack Cryptic Codes 


To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on, Twitter, FacebookGoogle+ or Linkedin



F# 8 Makes Code More Uniform And Performant

Microsoft has released the latest version of F#, with changes the team says makes F# programs simpler, more uniform and more performant. The new version also has faster project compilation and upgrade [ ... ]

PeerDB Brings Real Time Streaming To PostgreSQL

PeerDB is an ETL/ELT tool built for PostgreSQL. It makes all tasks that require streaming data from PostgreSQL to third party counterparts as effortless as it gets.

More News





or email your comment to:


Last Updated ( Wednesday, 23 December 2015 )