Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
4x4 desk game
#1
This is a digital version of a children's game. It is a board with squares, where one square is missing, the squares are shuffled and the goal is to put the squares back together. You can only move the piece that is next to the free space. The same principle applies in the game.

Unlike the original, after starting the program you can choose which version of the game you want to play. There is a choice from 2x2 to 10x10, with the option to set the number of shuffles. There is also a jump or smooth animation and sound when the picture is completed. The 2x2 version is so simple that it often happens that after shuffling the finished state comes out. But I think it is good for understanding the principle. That is why I recommend using the 3x3 and higher options.

Here I use photos from the default folder in your system. All pictures are loaded and then the first of them is divided into pieces. One piece is discarded, the other pieces are placed on the game board and shuffled. The goal is to put the picture back together. By pressing the spacebar, you can see how the assembled image should look. After the image is assembled, the original is released from memory and the next loaded image is processed. If someone solves all the images in their image folder, the program will be terminated. You can always terminate it with the Esc key.

If someone thinks during the game that the pieces are mixed up in such a way that it cannot be solved.... then press the A key. The automatic search for a solution will start and then the automatic completion of a specific image will be completed. This process cannot be interrupted. Automatic solution is not allowed for boards larger than 6x6 with 60 shuffles. I just didn't want to solve it anymore Smile

The program is tested only in Windows.
[Image: 4x4.png]


Attached Files
.zip   4x4.zip (Size: 12.11 KB / Downloads: 15)


Reply
#2
Neat! Is it easy to change pictures or increase squares from 4x4 to 5x5, 8x8, 16x16, etc.? 
I'm not at the PC to play with it or I would.
Reply
#3
@madscijr

That won't be a problem. If you want a size larger than 10x10 (which is selected from the pull-down menu at the start of the game), then set a larger number in the source code. If you set a high number of shuffles, you might be solving it until retirement Smile
The automatic solving system implemented in the program is limited. The reason is the exponentially increasing difficulty with the increase in the number of fields/tiles and shuffles, which can cause the game to search for a solution for several days. That is why it is fundamentally limited so that the search time is acceptable.
It is true that I toyed with the idea of trying a more powerful algorithm, but does it make sense? After all, even a 5x5 game with a lot of shuffles is already quite difficult to solve. The number of pieces is determined by the Pieces variable at the beginning of the program, and the number of shuffles is determined by the Mixes variable, also at the beginning of the program.
As you can see, it is made up of three parts:
  1. Game Setup
  2. Game
  3. Automatic Solver
That's exactly the order I developed it in. I guess it was about time – I've been thinking about doing it for about a year...


Reply


Forum Jump:


Users browsing this thread: