From 8333cba4fa549d29efc4d8303aa68173b2e58b9c Mon Sep 17 00:00:00 2001 From: ShenMian Date: Sun, 4 Feb 2024 15:51:45 +0800 Subject: [PATCH] docs: update docs --- .gitignore | 4 +-- README.md | 11 ++++---- docs/{ => assets}/auto_crate_push.gif | Bin docs/{ => assets}/auto_crate_push_1.png | Bin docs/{ => assets}/auto_crate_push_2.png | Bin docs/{ => assets}/auto_player_move.png | Bin docs/{ => assets}/auto_solve.gif | Bin docs/{ => assets}/solver_visualization.png | Bin docs/auto_move.md | 8 +++--- docs/configuration.md | 22 ++++++++++++++++ docs/database.md | 28 +++++++++++++++++++++ docs/solver.md | 4 +-- 12 files changed, 64 insertions(+), 13 deletions(-) rename docs/{ => assets}/auto_crate_push.gif (100%) rename docs/{ => assets}/auto_crate_push_1.png (100%) rename docs/{ => assets}/auto_crate_push_2.png (100%) rename docs/{ => assets}/auto_player_move.png (100%) rename docs/{ => assets}/auto_solve.gif (100%) rename docs/{ => assets}/solver_visualization.png (100%) create mode 100644 docs/configuration.md create mode 100644 docs/database.md diff --git a/.gitignore b/.gitignore index 22d70fb..52040ad 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,6 @@ /.vscode /.fleet /.idea -database.db -settings.toml +config.toml keymap.toml +database.db diff --git a/README.md b/README.md index 2520fed..48c56c4 100644 --- a/README.md +++ b/README.md @@ -4,19 +4,20 @@ A sokoban with solver. ## Features -- Integrated solver. -- Full mouse control. -- Player animation. +- [Integrated solver.](docs/solver.md) +- [Full mouse control.](docs/auto_move.md) - Front-end and back-end separation. - Levels and solutions are stored in the database. +- [Custom settings via configuration file.](docs/configuration.md) +- Player animation. ### [Auto move](docs/auto_move.md) -

+

### [Solver](docs/solver.md) -

+

## Keymap diff --git a/docs/auto_crate_push.gif b/docs/assets/auto_crate_push.gif similarity index 100% rename from docs/auto_crate_push.gif rename to docs/assets/auto_crate_push.gif diff --git a/docs/auto_crate_push_1.png b/docs/assets/auto_crate_push_1.png similarity index 100% rename from docs/auto_crate_push_1.png rename to docs/assets/auto_crate_push_1.png diff --git a/docs/auto_crate_push_2.png b/docs/assets/auto_crate_push_2.png similarity index 100% rename from docs/auto_crate_push_2.png rename to docs/assets/auto_crate_push_2.png diff --git a/docs/auto_player_move.png b/docs/assets/auto_player_move.png similarity index 100% rename from docs/auto_player_move.png rename to docs/assets/auto_player_move.png diff --git a/docs/auto_solve.gif b/docs/assets/auto_solve.gif similarity index 100% rename from docs/auto_solve.gif rename to docs/assets/auto_solve.gif diff --git a/docs/solver_visualization.png b/docs/assets/solver_visualization.png similarity index 100% rename from docs/solver_visualization.png rename to docs/assets/solver_visualization.png diff --git a/docs/auto_move.md b/docs/auto_move.md index 5d5c900..6d28c68 100644 --- a/docs/auto_move.md +++ b/docs/auto_move.md @@ -2,7 +2,7 @@ ## Auto crate push -

+

This feature can provide good assistance when users play larger levels. At the same time, it also retains the traditional control method. @@ -11,7 +11,7 @@ Clicking on a crate will display all the points that the crate can reach (withou Take Microban #155 as an example: -

+

Clicking on one of the points will automatically push the selected crate to that position. @@ -19,13 +19,13 @@ In this case, user can click on the target, and the character will automatically Some areas where the crates are reachable do not display points. This is because pushing the crate to those positions will lead to a deadlock and the player will be unable to continue completing the level. -

+

## Auto player move Click to select the player and display the player's reachable area. Click on a position in the area and the player will automatically move to that position. -

+

User can also directly click on the player's reachable area without selecting the player, and the player will automatically move to that position. diff --git a/docs/configuration.md b/docs/configuration.md new file mode 100644 index 0000000..1506659 --- /dev/null +++ b/docs/configuration.md @@ -0,0 +1,22 @@ +# Config + +User can configure settings by editing `config.toml` in the same directory. If the file does not exist, a default configuration file will be automatically generated when the program is run. + +```toml +# Player movement animation speed, seconds per step. +player_move_speed = 0.1 +# Make the floor look like a chessboard with alternating light square and dark square. +even_square_shades = 0.1 +# Audio volume. +volume = 0.5 +# Disable player movement animation. +instant_move = false +# Enable auto switch to next unsolved level when the current level is solved. +auto_switch_to_next_unsolved_level = true + +[solver] +strategy = "Fast" +lower_bound_method = "MinimumMove" +``` + +For `solver` related configuration options, please refer to [Solver](./solver.md). diff --git a/docs/database.md b/docs/database.md new file mode 100644 index 0000000..71e60fe --- /dev/null +++ b/docs/database.md @@ -0,0 +1,28 @@ +# Database + +Any imported levels will be permanently stored in a [SQLite] database. + +```txt +sqlite> SELECT * FROM tb_level LIMIT 1; ++----+------------+-----------------+----------+----------+-------+--------+--------------------+------------+ +| id | title | author | comments | map | width | height | hash | date | ++----+------------+-----------------+----------+----------+-------+--------+--------------------+------------+ +| 1 | Boxworld 1 | Thinking Rabbit | Level 1 | ### | 8 | 8 | 413779389415751139 | 2024-02-03 | +| | | | | #.# | | | | | +| | | | | # #### | | | | | +| | | | | ###$ $.# | | | | | +| | | | | #. $@### | | | | | +| | | | | ####$# | | | | | +| | | | | #.# | | | | | +| | | | | ### | | | | | ++----+------------+-----------------+----------+----------+-------+--------+--------------------+------------+ + +sqlite> SELECT * FROM tb_solution LIMIT 1; ++----------+--------------------+--------------------+ +| level_id | best_move_solution | best_push_solution | ++----------+--------------------+--------------------+ +| 1 | DuLLrUUdrR | LUUddLrrDuuR | ++----------+--------------------+--------------------+ +``` + +[SQLite]: https://www.sqlite.org/index.html diff --git a/docs/solver.md b/docs/solver.md index 4eedee8..3b6e392 100644 --- a/docs/solver.md +++ b/docs/solver.md @@ -1,6 +1,6 @@ # Solver -

+

The solver can automatically solve simple levels. @@ -43,4 +43,4 @@ Supports visualization of the automatic solution process. This feature can be us - Displays the optimal state obtained by the current solver. - Display the lower bound as a heat map. -

+