Here's a keypad puzzle that I made:

There are 9 keys on a keypad. You can open the door when all the keys are on. The problem is, pressing each key not only turns itself on or off, it also toggles the state of some other keys. Can you solve this puzzle?

To make it a little bit trickier, there is a certain probability that there is no solution at all! Can you figure it out?

You won!
Try again!



Motivation:

I love solving puzzles - in research, in life, or in games. But many "puzzles" in games are more like riddles - the clues are words, and the solutions are up to interpretation, sometimes there are ambiguities, and if it's translated into another language, very often some of the subtleties are lost in translation.

There are puzzles that don't need explanations, for example, the keypad puzzles below are from Silent Hill 2 and Resident Evil Village:

SH2 RE8

But these puzzles are very easy to solve. So I wonder, are there good mathematical/algorithmic puzzles? I searched "math puzzles" but they were not what I was thinking about.

So, I have this idea of creating some good puzzles that don't need much explanation but requirs good logic or algorithmic thinking to solve. The keypad puzzle above is a good example. It would be nearly impossible to solve it by trying luck and randomly clicking on the keys if the size of the problem is large, e.g. a 4 by 4 keypad or even larger, but there is a simple algorithm that can solve it very efficiently.

I have some other ideas which are all related to interesting mathematical or algorithmic problems, involving graph theory, linear algebra, number theory, etc. I want them to be difficult, but not too difficult - some of them are NP-complete, so I'll have to make a simpler version of it. Anyways, they are just ideas, and right now I don't have time to make a real game out of them. Maybe I'll try to see what I can do with them in the future, if I have some spare time...