Source: Grid shading by simulated annealing (or what I did on my holidays), aka “fun with GCHQ job adverts”, by Martyn Plummer, developer of JAGS.
Excerpt:
I wanted to solve the puzzle but did not want to sit down with a pencil and paper. So I decided to write an R program to solve it instead. Is this cheating? Crafty Alison seems to think so, but I was inspired by Christian Robert’s regular series of R-based solutions to the weekly Le Monde puzzle. He often uses probabilistic solutions to logical problems and I realised that this grid shading puzzle could be treated as a Bayesian inference problem.