[explorer, moves, position] Implement a moves command in explorer

The moves command writes all possible moves to the terminal.

Move the previous implementation of the moves command, which marked squares that
a piece could move to, to a 'movement' command.
This commit is contained in:
Eryn Wells 2025-05-28 16:25:55 -07:00
parent 43abbe3fe2
commit 942d9fe47b
4 changed files with 124 additions and 16 deletions

View file

@ -16,12 +16,20 @@ pub use pawn::PawnMoveGenerator;
pub use slider::{BishopMoveGenerator, QueenMoveGenerator, RookMoveGenerator};
use crate::Move;
use chessfriend_core::Square;
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct GeneratedMove {
pub(crate) ply: Move,
}
impl GeneratedMove {
#[must_use]
pub fn origin(&self) -> Square {
self.ply.origin_square()
}
}
impl std::fmt::Display for GeneratedMove {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.ply.fmt(f)