[explorer, moves, position] Implement bespoke make_move and unmake_move methods on Position

Instead of inheriting the MakeMove and UnmakeMove traits by being a BoardProvider,
implement bespoke versions of these two methods. This gives Position a chance to
do some of its own work (tracking captures, move records, etc) when making a move.

Pass the move record by reference to the unmake_move() method. Saves a copy.

Export the Result types for MakeMove and UnmakeMove.
This commit is contained in:
Eryn Wells 2025-06-01 19:02:53 -07:00
parent 724a98c2e2
commit 8f42a4c94e
5 changed files with 66 additions and 45 deletions

View file

@ -1,9 +1,11 @@
// Eryn Wells <eryn@erynwells.me>
mod make_command;
use chessfriend_board::{fen::FromFenStr, Board};
use chessfriend_core::{Color, Piece, Shape, Square};
use chessfriend_moves::{Builder as MoveBuilder, GeneratedMove};
use chessfriend_position::{fen::ToFenStr, PlacePieceStrategy, Position, ValidateMove};
use chessfriend_moves::{Builder as MoveBuilder, GeneratedMove, MakeMove, ValidateMove};
use chessfriend_position::{fen::ToFenStr, PlacePieceStrategy, Position};
use clap::{Arg, Command};
use rustyline::error::ReadlineError;