kirill live

Fifteen Sliding Puzzle maker - free and open-source classic mini game

A simple implementation of the classic mini-game Fifteen Sliding Puzzle, without using Canvas or third party libraries. Editor: https://kirilllive.github.io/Fif... Demo: https://kirilllive.github.io/Fif...

Add a comment

Replies

Best
kirill live
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. 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.