ILP Part 97 — Rook it advanced

This is the ninetieth seventh part of the ILP series. For your convenience you can find other parts in the table of contents in Part 1 – Boolean algebra

Today we are going to solve the advanced version of Uwież (Rook it). We use the solution from the last part. This time we have walls with letters, so we don’t know what numbers they represent. Also, one of the fields of the board is not attacked.

The code:

Most of the code should be familiar. The changes are in two places.

Lines 51-57 – we need to create variables for letters. We then use them in counting neighbours in lines 60-74.
Line 151 – we make sure that all fields but one are covered.
We also print the result differently, so we can see which field is not attacked.

The output: