Monday, January 6, 2014

An Exercise for the Mind: a 10 by 10 Math Puzzle: a Pattern Recognition Game: Meditation on an Open Maze


UPDATE 5 (EDIT): Here are two versions of the game available online to play for free: Version #1 and Version #2. And here are some solutions provided by cochd using the online game. Fun :)

UPDATE 4: Playlist for videos, including live streams, related to this game available here: 10 by 10 Grid and Multiplication Table, plus a Math Puzzle, a Pattern Recognition Game.

UPDATE 3: Two elegant solutions to this puzzle, completing it by breaking it down into four quadrants, provided here by JoxnJoxn and here by Alex K..

UPDATE 2: I put together the following video for my ASMR Math series showing the gameplay. Hope you enjoy :)

UPDATE 1: See end of post for some code that was provided by a couple of people to help play and obtain solutions for this game. A big thank you to Nicklas and angelatheist for helping out with this.

    A few years ago one of my students introduced me to a simple and intriguing game. He didn’t know where the game originated from but said that it was popular in Turkey, and that he and his friends loved playing it.

    It is probably best categorised as a mathematical puzzle that requires no arithmetic calculations, just placements of numbers based on two rules; hence I prefer to refer to this puzzle as a pattern recognition game, or simply, an exercise for the mind using an open maze – a meditation of sorts.

The Purpose of the Game
    To take a 10 by 10 grid, equaling 100 squares, and completely filling in every square based on two types of movements.

The Rules are Simple
    1) Create a 10 by 10 grid (graph paper or a spread sheet will come in very handy).

    2) Fill one of the squares with the number 1, then, based on the following two movement types, use consecutive numbers to fill in the rest of the grid:
      Movement Type I: If the next number in the sequence is going to be placed vertically or horizontally, then it must be placed exactly three squares away from the previous number - there must be a two square gap between the numbers.

      Movement Type II: If the next number in the sequence is going to be placed diagonally, then it must be placed exactly two squares away from the previous number - there must be a one square gap between the numbers.

    3) Numbers can only be placed in empty squares - once a square has been used it can not be used again. All placements must occur within the grid.

    4) Game is complete when the number 100 is reached - when all empty squares in the grid are filled. If you cannot continue placing numbers based on the two movement types above, and empty squares remain in the grid, then the puzzle is not complete and the game lost.

Two Incomplete Examples and a Solution
    Example 1: The first example is one where I tried to get the worst possible result. I was able to end the game in 6 moves.

    Example 2: The second example is my best result so far. In this example I was able to reach 99 – one move short of finishing the game.

    A Solution: The final example is a solution completed by my student who introduced me to the game. He had been playing this game for approximately three years, and this was the only solution that he had been able to obtain during this period. This means that we know there will be at least four solutions to this game – the one presented below and its three mirrors (CORRECTION: As Mark VP pointed out in the comments, "if you have a solution, there are 7 other ones you can get through symmetries, e.g. 3 by rotating, and 4 more by mirroring those 4 around a diagonal." Thank you, Mark, for three extra solutions). It would be interesting to find out how many solutions actually do exist - any mathematicians or programmers out there interested in tackling this problem?

    Aside from creating a weighted scoring system or using symbols instead of numbers to fill in the squares, two variants could be: 1) give a starting point and an end point for the game – this will dramatically increase the difficulty of the puzzle; 2) create different types of grids but maintain the same placement rules – an example is presented below.

For anyone who wants to try this out, below you will find a sheet with 12 grids (click to enlarge). Ideally, a simple program based on the parameters above loaded on a device with a touchscreen would be the best way to play this game. If you are into such things, I hope the game entertains you, and if you find anymore solutions, please send them my way. Thanks in advance.

Play Online:
    1) Here are two versions of the game available online to play for free: Version #1 and Version #2. Thank you to the peeple that put these together. Good luck and Enjoy.

    1) See Nicklas Kulp's comment below for a link to a Jar file that runs a program that allows you to play on a 10 by 10 grid on your computer. Seems legit and worked for me, so thank you Nicklas (the file).

    2) See angelatheist's comment below for a link to a python script to get solutions to this puzzle (link to the code). Thanks angelatheist.



  1. I took the time to code this in Java. You can download it, if you want:

    1. Very cool, it seems to work. I'm usually very hesitant on downloading random linked software but had to give this one a try and so far so good. You just saved me a lot of paper as well as time in excel... thank you :)

    2. I just found out about this today but yeah thanks.

  2. I wrote a python script to get solutions to this puzzle. With the current order of moves it comes up with a solution pretty quickly. Python source here:

    1. That code looks beautiful, wish I was a programmer so I knew what to do with it. Thanks for putting this together, hopefully those more in the know will be able to make good use of it.

      I'll add the link as an update at the bottom of the post.

      Peace :)

  3. A little nitpicking: if you have a solution, there are 7 other ones you can get through symmetries, e.g. 3 by rotating, and 4 more by mirroring those 4 around a diagonal.

    1. OMG! Three by rotating! Thank you, thank you. I just added the correction to the post. Peace :)

  4. Found another solution:
    The red numbers are the last placed, I thought it made a cool pattern. Notice I started with 1 on the edge, not a corner

  5. Online version someone put together:

  6. Joxn, on his channel "The Appertainers", has provided an awesome video tutorial on how to approach this problem using his knowledge of Chess and "The Knight's Movement". He provides an excellent explanation and very easy to follow steps to solving the puzzle. Here is the link to the video:

    Much love and respect to Joxn for putting this together. Very much appreciated :)