[moves, position] Move MoveRecord to the moves crate
This commit is contained in:
parent
b8f45aaece
commit
34e8c08c36
5 changed files with 8 additions and 7 deletions
|
@ -6,8 +6,10 @@ pub mod testing;
|
|||
mod builder;
|
||||
mod defs;
|
||||
mod moves;
|
||||
mod record;
|
||||
|
||||
pub use builder::{Builder, Error as BuildMoveError, Result as BuildMoveResult};
|
||||
pub use defs::{Kind, PromotionShape};
|
||||
pub use generators::GeneratedMove;
|
||||
pub use moves::Move;
|
||||
pub use record::MoveRecord;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
// Eryn Wells <eryn@erynwells.me>
|
||||
|
||||
use crate::Move;
|
||||
use chessfriend_board::{board::HalfMoveClock, Board, CastleRights};
|
||||
use chessfriend_core::{Color, Piece, Square};
|
||||
use chessfriend_moves::Move;
|
||||
|
||||
/// A record of a move made on a board. This struct contains all the information
|
||||
/// necessary to restore the board position to its state immediately before the
|
||||
/// move was made.
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub(crate) struct MoveRecord {
|
||||
pub struct MoveRecord {
|
||||
/// The color of the player who made the move
|
||||
pub color: Color,
|
||||
|
||||
|
@ -29,6 +29,7 @@ pub(crate) struct MoveRecord {
|
|||
}
|
||||
|
||||
impl MoveRecord {
|
||||
#[must_use]
|
||||
pub fn new(board: &Board, ply: Move, capture: Option<Piece>) -> Self {
|
||||
Self {
|
||||
color: board.active_color,
|
|
@ -1,6 +1,5 @@
|
|||
// Eryn Wells <eryn@erynwells.me>
|
||||
|
||||
mod move_record;
|
||||
mod position;
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
@ -9,11 +9,10 @@ use chessfriend_moves::{
|
|||
AllPiecesMoveGenerator, BishopMoveGenerator, KingMoveGenerator, KnightMoveGenerator,
|
||||
PawnMoveGenerator, QueenMoveGenerator, RookMoveGenerator,
|
||||
},
|
||||
GeneratedMove,
|
||||
GeneratedMove, Move, MoveRecord,
|
||||
};
|
||||
pub use make_move::{MakeMoveError, ValidateMove};
|
||||
|
||||
use crate::move_record::MoveRecord;
|
||||
use captures::CapturesList;
|
||||
use chessfriend_bitboard::BitBoard;
|
||||
use chessfriend_board::{
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// Eryn Wells <eryn@erynwells.me>
|
||||
|
||||
use crate::{move_record::MoveRecord, Position};
|
||||
use crate::Position;
|
||||
use chessfriend_board::{
|
||||
castle::CastleEvaluationError, movement::Movement, Board, PlacePieceError, PlacePieceStrategy,
|
||||
};
|
||||
use chessfriend_core::{Color, Piece, Rank, Square, Wing};
|
||||
use chessfriend_moves::Move;
|
||||
use chessfriend_moves::{Move, MoveRecord};
|
||||
use thiserror::Error;
|
||||
|
||||
type MakeMoveResult = Result<MoveRecord, MakeMoveError>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue