Hopefully by this point we’ve managed to convince ourselves that solutions to this puzzle exist and they can be found at the very least through exhaustive search. But it’s one thing to say you can do something and an entirely different thing to actually do it.
In this third part of the series I hope to present an acceptable programmatic method of finding all the solutions to the puzzle. The approach I’ll be taking has the fancy name Backtracking Search but should be easy to follow even without a history in programming.
You can read Part I here: https://newtonmigosi.medium.com/an-additive-game-part-i-b8a6a2935ae3
We left Part I having found one solution that fits the rules, but we didn’t come up with a general way to find more solutions. The method of swapping cards was also arbitrary depending on unspecified heuristics.
Let’s take some time to review the problem again:
Here’s a game four people can play using a deck of poker cards.
The objective of this game is to arrange your suit along the edges of a 4x4 square where every edge sums up to 23. For the purposes of our game we’ll take the Ace to have a value of one, the Jack to have a value of eleven and the King to have a value of thirteen.
An initial approach would be to first lay…