Jon Leaman

How I solved Aristotle’s Puzzle in 1 Hour (no spoilers)

I was given Aristotle’s Number game as a gift this Christmas.  The difficulty on the back read “Nightmarish”, but I wasn’t scared.  That said, my title may be misleading.  It took me 3-4 days to figure out all 12 solutions, but my script only took 1 hour and 3 minutes to run through the 250m permutations I was able to break it down into.  How this puzzle is solved without a computer is mind boggling.  gameBoard

The rules are simple.  You have 19 hex pieces that have a number 1-19 on them.  They need to be placed on the board, seen above, so that all rows sum to 38.  That’s in any direction, leaving 15 different rows that need to sum to 38.

I started as anyone might start.  Manually plugging away.  After getting ‘close’ a few times and failing, I figured I could brute force this, so I opened Excel.  That tactic turned out to be laughable.  With 19! possible combinations, I needed to narrow down my search.  How many tiles did I need to solve to figure out the rest of the puzzle?  Well, after some failed attempts, it’s possible to take the 15 equations that should sum to 38 and reduce them down to 12 equations with 7 independent variables!  That means we will only need to solve 19!/(19-7)! iterations.  The process to derive these equations is called Guassian Elimination.  Huge props to hwiechers (Careful, this link contains a spoiler!) for showing me these equations — I had to take them at face value given my limitations in this area.

Once I had these equations it didn’t take much time at all to write the script to take the iterations, solve the equations, and check if everything added up.  My code can be foundhere:

Boy am I happy to be done with this puzzle!

Cheers and have a happy New Year!