Skip to content

Commit

Permalink
docs: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ShenMian committed Feb 4, 2024
1 parent 06c71c8 commit ab3adff
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
/.vscode
/.fleet
/.idea
database.db
settings.toml
config.toml
keymap.toml
database.db
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
- [Levels and solutions are stored in the database.](docs/database.md)
- [Custom settings via configuration file.](docs/configuration.md)
- Player animation.

### [Auto move](docs/auto_move.md)

<p align="center"><img src="./docs/auto_crate_push.gif" width=50%></p>
<p align="center"><img src="./docs/assets/auto_crate_push.gif" width=50%></p>

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

<p align="center"><img src="./docs/auto_solve.gif" width=50%></p>
<p align="center"><img src="./docs/assets/auto_solve.gif" width=50%></p>

## Keymap

Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
8 changes: 4 additions & 4 deletions docs/auto_move.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Auto crate push

<p align="center"><img src="auto_crate_push.gif" width=70%></p>
<p align="center"><img src="assets/auto_crate_push.gif" width=70%></p>

This feature can provide good assistance when users play larger levels.
At the same time, it also retains the traditional control method.
Expand All @@ -11,21 +11,21 @@ Clicking on a crate will display all the points that the crate can reach (withou

Take Microban #155 as an example:

<p align="center"><img src="auto_crate_push_1.png" width=70%></p>
<p align="center"><img src="assets/auto_crate_push_1.png" width=70%></p>

Clicking on one of the points will automatically push the selected crate to that position.

In this case, user can click on the target, and the character will automatically push the selected crate to the target to complete the level.

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.

<p align="center"><img src="auto_crate_push_2.png" width=70%></p>
<p align="center"><img src="assets/auto_crate_push_2.png" width=70%></p>

## 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.

<p align="center"><img src="auto_player_move.png" width=70%></p>
<p align="center"><img src="assets/auto_player_move.png" width=70%></p>

User can also directly click on the player's reachable area without selecting the player, and the player will automatically move to that position.

Expand Down
22 changes: 22 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -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).
28 changes: 28 additions & 0 deletions docs/database.md
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions docs/solver.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Solver

<p align="center"><img src="auto_solve.gif" width=70%></p>
<p align="center"><img src="assets/auto_solve.gif" width=70%></p>

The solver can automatically solve simple levels.

Expand Down Expand Up @@ -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.

<p align="center"><img src="solver_visualization.png" width=70%></p>
<p align="center"><img src="assets/solver_visualization.png" width=70%></p>

0 comments on commit ab3adff

Please sign in to comment.