All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 A's, B's, C's and D's 3 (Posted on 2019-09-14)
Place one of A, B, C or D into each of the 25 empty squares so that the number of letters in each row and column match the number indicated on that row and column for that letter.

Identical letters cannot be next to each other vertically or horizontally, but may be adjacent diagonally.

```

+---+---+---+---+---+
A  | 2 | 1 | 2 | 1 | 0 |
+---+---+---+---+---+
B  | 0 | 2 | 0 | 2 | 2 |
+---+---+---+---+---+
C  | 1 | 0 | 2 | 2 | 2 |
+---+---+---+---+---+
A   B   C   D  | 2 | 2 | 1 | 0 | 1 |
+---+---+---+---++===+===+===+===+===+
| 1 | 2 | 2 | 0 ||   |   |   |   |   |
+---+---+---+---++---+---+---+---+---+
| 1 | 1 | 2 | 1 ||   |   |   |   |   |
+---+---+---+---++---+---+---+---+---+
| 1 | 2 | 0 | 2 ||   |   |   |   |   |
+---+---+---+---++---+---+---+---+---+
| 2 | 0 | 1 | 2 ||   |   |   |   |   |
+---+---+---+---++---+---+---+---+---+
| 1 | 1 | 2 | 1 ||   |   |   |   |   |
+---+---+---+---++---+---+---+---+---+

```

From Mensa Puzzle Calendar 2019 by Fraser Simpson, Workman Publishing, New York. Puzzle for September 5.

 See The Solution Submitted by Charlie No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 soln Comment 1 of 1
`rabbit-3:~ lord\$ g77 -o walk walk.f`

rabbit-3:~ lord\$ walk

`Success!                `
`        C  B  A  C  B    A  D  C  B  C    D  B  D  A  B    A  D  A  C  D    D  A  C  B  C      `

`  `

This seemed hard, but finally was not. 1st  I systematically tried possibilities (like trying combinations of B's in one row and A's in another). But the bookkeeping became too much. Then I tried pre-setting cells at the intersection of 2 in one row and 2 in one col by giving the cell that letter, and then I played around with the rest. This proved futile. Then I wrote a program that started with an A in the first square, and then a B in the second, etc., backing-up if ABCD was run through unsuccessfully. I.e, checking against the constraints in any square and backing-up positionally and advancing the symbol in the previous cell. (This algorithm has a name I forget.) This solved it, but then looking through what the program had done, I realized this method would have gone quickly even if done by hand! (I think having no "D"s in the top line helped it succeed quickly.)

Edited on September 15, 2019, 6:58 pm
 Posted by Steven Lord on 2019-09-14 22:52:24

 Search: Search body:
Forums (0)