fivemack: (Default)
Here is a program for solving puzzles of a type that someone was doing at pizza on Monday, where a puzzle-setter has drawn some black squares in a grid, and labelled some of the squares in the grid with the number of neighbours (including themselves) that are black.

It's in Common Lisp, which I'm playing with on the principle of learning at least one new programming language per place of employment. It's probably dreadfully badly written; the algorithm it uses isn't guaranteed always to work, but probably works on all problems set on the assumption that they'll be solved by humans.

There seem to be lots of these grid-based puzzles appearing at the moment, in the wake of sudoku; I tend to look at them, write a program to solve them, and then discard the problem as thereafter uninteresting; Dad does sudoku at the breakfast-table most mornings. Sudoku's somehow become the standard of comparison for unprofitable intellectual effort - a genius friend of mine described philosophy (in which he had a fellowship at All Souls - as I said, genius) as more-advanced sudoku shortly before starting to retrain as a lawyer.

July 2017

S M T W T F S
      1
2345678
9101112131415
161718 19202122
23242526272829
3031     

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Oct. 17th, 2017 07:30 am
Powered by Dreamwidth Studios