Problem 15 puzzle game


In my first implementation of this game, I often noticed that the last two puzzle squares could not be placed in the right places. At first it seemed to me that something was wrong with me, but the situation where the puzzle was not solved was stable, and I began to figure out what went wrong.

After reading several articles on the mathematical analysis of this game, I learned that exactly half of all possible combinations of the initial position of the squares (20.922.789.888.000 (= 16!)) Will lead to the impossibility of solving the puzzle. Elsewhere I found out that this problem occurs if swap squares 14 and 15. In such a situation, in my game, I used mixing squares, just replacing the random block with another random block, it was a very wrong decision. So I decided to replace this part of the game with a natural shuffle, the program just randomly shifted an empty block vertically or horizontally by one square. This option eliminated combinations of blocks that would get in the way of solving the puzzle.

About ten years ago I was making a similar game for Android, but then I did not face this problem, because the terms of reference said: "the movement of the squares when mixing should be visible." And then I remembered about one more item of the same task "The ability to move several blocks towards an empty cell." Oddly enough, when I tackled the previous problem, almost all versions of this game that I have seen did not use this feature. Then I decided to add the ability to move several blocks to my game, and the game became more interesting, the puzzle began to be assembled faster and new tactical possibilities appeared, but, most importantly, it became easier to collect large puzzles with 100 chips or more.

This is how a simple game became an interesting experience for me with new discoveries, despite the fact that I had done it before, with the only difference that at first I did the game on a task, and now for the sake of testing my skills.

Editor | Demo | GitHub

Get Fifteen Sliding Puzzle maker

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.