harden engine rules, position invariants, and undo history

- make Position represent only valid board squares and use checked offsets
- make move endpoints fallible and remove unchecked coordinate arithmetic
- validate moves against generated legal moves, including mandatory capture
- track pending multi-captures and restrict continuation to the same piece
- derive pending state after undo/redo and preserve redo on invalid moves
- fix circular buffer wraparound, mixed iteration, and element drops
- adapt GTK and WASM to fallible endpoints and apply errors
- add rule, promotion, chain, history, and coordinate regression tests
This commit is contained in:
2026-10-19 19:43:05 +00:00
parent 5ab62eaabc
commit dc0ad17a95
8 changed files with 750 additions and 461 deletions
+1
View File
@@ -21,6 +21,7 @@ The rules implemented by the engine are an 8x8 draughts variant:
- Each player starts with twelve men.
- Captures are mandatory.
- A multi-capture sequence must be completed with the same piece.
- Men move one square diagonally forward.
- Men cannot capture backwards in this implementation.
- Kings move one square diagonally in any direction and can capture in any