← Back to writing

Math-Sticks: Yet Another Puzzle Game

Yes. Another puzzle game. To go with the others I’m building.

This one is inspired by the picture puzzles on social media with matchsticks asking you to move one or two to get a number greater than what is shown.

Matchstick Puzzles

As part of writing this article, I discovered that there’s a whole category of these, with a Wikipedia entry even. A popular entry is having invalid mathematical equations that can be fixed by moving a single matchstick. There are also others that require moving a matchstick in order to achieve some shape (e.g 5 squares).

I’m most interested in the number based ones. First, because those are the kinds that inspired building this, second because both other kinds I’ve discovered today are both harder to generate programmatically or via an LLM. Numbers on the other hand are exceptionally easy to generate and evaluate programatically.

Gameplay

I’m still undecided on the game mechanics. Here are my thoughts so far:

  • Generate random number from 100 to 999
  • Render the number as a seven segment display. This is the kind of display used in digital calculators and other LED screens. It’s made up of a series of connected horizon and vertical lines to form digits (and a limited set of alphabets)
  • Give the player 3 moves where they can take a line and add somewhere else on the screen
  • Check that whatever the user has constructed with the lines is both a valid number and is greater than the original generated random number.
  • Profit

However, this doesn’t quite work. As it stands, they can generate one number higher than the original, and then what? Higher numbers each time? That could work, but one problem is getting a “9xx” either as the randomly generated number or as a constructed number is terminal. No where else to go, but ideally, I would want no upper bound or at least one that isn’t so easily reached. So we will have to figure out the win condition.

In terms of generating puzzles, it will be straightforward, since all we need to do is generate numbers between 100 and 999.

In terms of evaluating the answers that should also be fairly straightforward since we can compare the positions set by the user against the set of digits in seven segment displays.

Conclusion

Off to think about how to make this a fun, long running set of puzzles. Wish me luck and hopefully see you playing it soon!

Related Items

Related Notes