Many mathematicians enjoy puzzles – and digging in to interesting code. Simon’s Puzzle collection is an open source collection of puzzles that any mathematician would enjoy:
This Puzzle Collection is available for Android and other platforms as an offline app, plus any device that is able to access the web at https://www.chiark.greenend.org.uk/~sgtatham/puzzles/ Let’s look at the mathematical concepts behind some of his puzzles:
This is an interesting way to learn the difference between planar and nonplanar graphs. A planar graph can be arranged such that no edges (lines) cross. In this puzzle you uncross the lines by moving the points. Note that planar/non-planarity of a graph could be different when on different objects such as a donut vs a plane!
As you may recall, it was proven a number of years ago that a map of any country borders can be colored with four colors without a line near another similar color. This is known as the four-color theorem and you can read more of its history and computer-solved proof here, a more interactive introduction can be found here.
In this puzzle one drags one color into another area, until all are colored and set up with colors not touching each other.
This is also known as Sudoku (Is that a trademarked term??) It allows both the traditional 3×3 and easy 2×2 like so: Simply enter numbers so no row, column or region has the same number…
This is a well-known math puzzle where the only move is sliding a tile to the empty spot. There have been some interesting math analysis of this, including that half of these arrangements would be impossible to actually rearrange in the right order and solve. (A good way to infuriate a puzzle solver?)
This is somewhat of a logic puzzle, but is more well known as being the one annoying logic game that came with every computer with Windows 95 (or was it 98?):
Unlike most puzzles you might find on Google Play or iOS App Store, this has source code you can browse and learn if you know a bit of C programming. You can download a copy off the website (here). The frontend user interaction code is separated from the puzzle logic which is in a named file for each puzzle (untangle.c, unequal.c, etc.) and in addition to the comments in code there is developer documentation here. One thing of particular interest is that each of these games has the solve_game function which has an algorithm for solving each puzzle… genius!