Simple program made in Rust to solve Klotski.
Klotski is a sliding puzzle game quite popular even though few know its name. In this game, the player has several blocks and has to move the biggest of them to the bottom center of the board. It has other names such as:
- Klocki in Polish (it's pronounced like Klotski)
- Huarong Dao or 華容道 in Chinese
- Daughter in the box, hakoiri musume or 箱入り娘 in Japanese
- L'âne rouge in French
- Khun Chang Khun Phaen in Thai
I made this project in Rust to learn how to program with it, but also because I wasn't able to solve Klotski manually :)
The code is really fast when built with --release
mode, but also thanks to the use of a simple A* search algorithm
- Clone this repository on your computer
- Install
rustup
- Run
cargo run
orcargo run --release
. After a short time, the solution will appear. You may need to change themain()
andsolve_klotski()
functions in order to show all the steps between the initial state and the final solution.