# Problem: The Spanish Dungeon

Not fifty miles from Cadiz stood in the middle ages a castle, all traces of which have for centuries disappeared. Among other interesting features, this castle contained a particularly unpleasant dungeon divided into sixteen cells, all communicating with one another, as shown in the illustration.

Now, the governor was a merry wight, and very fond of puzzles withal. One day he went to the dungeon and said to the prisoners, "By my halidame!" (or its equivalent in Spanish) "you shall all be set free if you can solve this puzzle. You must so arrange yourselves in the sixteen cells that the numbers on your backs shall form a magic square in which every column, every row, and each of the two diagonals shall add up the same. Only remember this: that in no case may two of you ever be together in the same cell."

One of the prisoners, after working at the problem for two or three days, with a piece of chalk, undertook to obtain the liberty of himself and his fellow-prisoners if they would follow his directions and move through the doorway from cell to cell in the order in which he should call out their numbers.

He succeeded in his attempt, and, what is more remarkable, it would seem from the account of his method recorded in the ancient manuscript lying before me, that he did so in the fewest possible moves. The reader is asked to show what these moves were.

Solutions: 1

Thank you to the contributors under CC BY-SA 4.0!

Github:

non-Github:
@H-Dudeney

### References

#### Project Gutenberg

1. Dudeney, H. E.: "Amusements in Mathematics", The Authors' Club, 1917

This eBook is for the use of anyone anywhere in the United States and most other parts of the world at no cost and with almost no restrictions whatsoever. You may copy it, give it away or re-use it under the terms of the Project Gutenberg License included with this edition or online at http://www.gutenberg.org. If you are not located in the United States, you'll have to check the laws of the country where you are located before using this ebook.