INDEX
Klotski Optimal Solver
Ver1.0 (Dec/2024)

1. Download

klotskiw.exe (405KB)
        for Windows.

2. Basic usage
[Edit] You can edit the problem.
[Play] You can play by yourself.
[Solver] Solver finds the optimal solution.
  Please try suitably except it.
3. Algorithm
This program uses a breadth-first search.
However, there are two priority tables to take into account the case
where consecutive movements are considered as one step.
(The number of steps increases and the number does not increase)
4. Definition of One-Step
There appear to be no official rules for the definition of one step in this puzzle game.
There are multiple possible rules based on the combination of the following two elements:

 1. Should continuous movement be considered one step?
 2. Can I push other pieces to move them? (The actual item can be moved)

This solver program allows to choose between these two elements.
It is generally said that the optimal solution to this puzzle is 81 steps,
but this is not necessarily the case.
5. Change skin
You can change the image to something you have rewritten
yourself. You can also download the image on the right.
If you place "skin.bmp", it will take priority.
Name the file "skin.bmp" and place it in the same folder
as this program
. The image is in bitmap format.
 
skin0.bmp
  
skin1.bmp
  
skin2.bmp
6. Source code
Visual Studio Community (free) must be installed. During installation,two modules are required.
Please check the icon. Sorry the image is in Japanese.

  Windows type klotskiw.zip  Open klotskiw.sln  The solver code file is the same. 
 (hako10solver.c) 
 Command line type 
 (Solver Research) 
 klotskic.zip  Open klotskic.sln 
Please research how to build with Visual Studio Community and other usage methods yourself.
Please note that the source code for the Windows type is very messy.
7. Addition
I wonder what kind of problem diagram would result in the
longest number of steps. So I rewrite the command line source
code as shown on the right. It is single-threaded, so it takes
time to execute, but the answer will be given. The general rule 
is 138 steps. Please check the actual diagram yourself.
Additional source code

It is set to output files
FILE1 to 7.txt for 2X2
blok positions (7 ways).

INDEX