fix frontend board mapping, game-over handling, and WASM-4
- fix Xform yx and add a shared view-aware board_position helper - add GTK automatic game-over, restart, status, and multi-capture selection - pin librsvg to the 2.60 series to match GTK4/glib 0.20 - add WASM orientation, undo/redo/new/flip controls, and winner overlay - replace WASM crown images with canvas paths and remove dead files/deps - make WASM-4 playable with mouse input, crowns, winner handling, and correct mapping - move the WASM-4 release profile to the workspace root - clean up frontend dead code and update the README
This commit is contained in:
@@ -9,12 +9,16 @@ several front ends.
|
||||
| --- | --- |
|
||||
| `rdraught` | `no_std` game engine, move generation, AI, and undo/redo history. |
|
||||
| `rdraught-ui-common` | Small geometry and shared-state helpers used by the graphical front ends. |
|
||||
| `rdraught-gtk` | GTK4 desktop front end (the most complete one). |
|
||||
| `rdraught-wasm` | Browser front end using the Canvas 2D API and `wasm-bindgen`. |
|
||||
| `rdraught-w4` | WASM-4 front end. Work in progress. |
|
||||
| `rdraught-sdl` | SDL3 front end. Work in progress. |
|
||||
| `rdraught-gtk` | Playable GTK4 desktop front end. |
|
||||
| `rdraught-wasm` | Playable browser front end using the Canvas 2D API and `wasm-bindgen`. |
|
||||
| `rdraught-w4` | Playable WASM-4 front end. |
|
||||
| `rdraught-sdl` | SDL3 prototype; not wired to the game yet. |
|
||||
| `rdraught-cli` | Scratch `rustyline` program; not a playable CLI yet. |
|
||||
|
||||
The GTK, WASM, and WASM-4 front ends are currently hot-seat games: both sides
|
||||
are played by people. The core AI is available but is not wired into a frontend
|
||||
yet.
|
||||
|
||||
## Rules
|
||||
|
||||
The rules implemented by the engine are an 8x8 draughts variant:
|
||||
@@ -35,7 +39,8 @@ The engine exposes a fixed-depth negamax search with alpha-beta pruning through
|
||||
`DraughtsGame::get_best_move(max_depth)`. A depth of zero is treated as one ply.
|
||||
Wins and losses dominate material scoring, and faster wins are preferred. The
|
||||
search has no time or node budget and no draw/repetition detection, so choose a
|
||||
modest depth for positions with many pieces.
|
||||
modest depth for positions with many pieces. The current frontends do not use
|
||||
the AI; they are hot-seat games.
|
||||
|
||||
## Requirements
|
||||
|
||||
@@ -79,6 +84,11 @@ below instead.
|
||||
cargo run -p rdraught-gtk
|
||||
```
|
||||
|
||||
Use the board orientation selector at startup, click a piece to select it, and
|
||||
click a highlighted destination to move. The header bar has undo, redo, and
|
||||
New Game buttons. The game-over dialog appears automatically; use New Game to
|
||||
start another game.
|
||||
|
||||
### Browser WASM
|
||||
|
||||
```sh
|
||||
@@ -87,6 +97,13 @@ cd rdraught-wasm
|
||||
trunk serve --open
|
||||
```
|
||||
|
||||
Click a piece and then a highlighted destination. Keyboard controls:
|
||||
|
||||
- `Ctrl+Z` — undo
|
||||
- `Ctrl+Y` or `Ctrl+Shift+Z` — redo
|
||||
- `N` — new game
|
||||
- `F` — flip the board orientation
|
||||
|
||||
The `.cargo/config.toml` inside `rdraught-wasm` is only read when Cargo runs
|
||||
from that directory.
|
||||
|
||||
@@ -97,8 +114,12 @@ cd rdraught-w4
|
||||
cargo build --release --target wasm32-unknown-unknown
|
||||
```
|
||||
|
||||
Run Cargo from `rdraught-w4` so its linker configuration is applied. The
|
||||
resulting module is in `target/wasm32-unknown-unknown/release/`.
|
||||
Run Cargo from `rdraught-w4` so its linker configuration is applied. The module
|
||||
is written to `../target/wasm32-unknown-unknown/release/rdraught_w4.wasm`.
|
||||
|
||||
Use the mouse to select a piece and click a highlighted destination to move.
|
||||
After a win, click to start a new game. The board is shown in a fixed
|
||||
orientation for hot-seat play.
|
||||
|
||||
### SDL3
|
||||
|
||||
|
||||
Reference in New Issue
Block a user