[core,board] Move board::piece to core

Break up types in core into finer grained modules.
Update all the imports.
This commit is contained in:
Eryn Wells 2024-01-24 17:08:27 -08:00
parent 6f85305912
commit 8b2a3926b3
25 changed files with 235 additions and 227 deletions

View file

@ -1,13 +1,10 @@
// Eryn Wells <eryn@erynwells.me>
use crate::{
piece::{PlacedPiece, Shape},
position::flags::Flags,
r#move::Castle,
Color, MakeMoveError, Move, Piece, Position,
position::flags::Flags, r#move::Castle, sight::SightExt, MakeMoveError, Move, Position,
};
use chessfriend_bitboard::BitBoard;
use chessfriend_core::{Direction, Square};
use chessfriend_core::{Color, Direction, Piece, PlacedPiece, Shape, Square};
/// A position builder that builds a new position by making a move.
#[derive(Clone)]
@ -244,7 +241,8 @@ impl<'p> From<&'p Position> for Builder<'p, NoMove> {
#[cfg(test)]
mod tests {
use super::*;
use crate::{r#move::Castle, MoveBuilder, PositionBuilder};
use crate::{position, r#move::Castle, MoveBuilder, PositionBuilder};
use chessfriend_core::piece;
#[test]
fn move_white_pawn_one_square() -> Result<(), MakeMoveError> {

View file

@ -1,12 +1,11 @@
// Eryn Wells <eryn@erynwells.me>
use crate::{
piece::{PlacedPiece, Shape},
position::{flags::Flags, piece_sets::PieceBitBoards},
r#move::Castle,
Color, MakeMoveError, Move, Piece, Position,
MakeMoveError, Move, Position,
};
use chessfriend_core::{Rank, Square};
use chessfriend_core::{piece, Color, Piece, PlacedPiece, Rank, Shape, Square};
use std::collections::BTreeMap;
#[derive(Clone)]
@ -130,6 +129,7 @@ impl Default for Builder {
#[cfg(test)]
mod tests {
use crate::PositionBuilder;
use chessfriend_core::piece;
#[test]
fn place_piece() {

View file

@ -40,7 +40,8 @@ impl<'a> fmt::Display for DiagramFormatter<'a> {
#[cfg(test)]
mod tests {
use super::*;
use crate::Position;
use crate::{position, Position};
use chessfriend_core::piece;
#[test]
#[ignore]

View file

@ -1,6 +1,7 @@
// Eryn Wells <eryn@erynwells.me>
use crate::{r#move::Castle, Color};
use crate::r#move::Castle;
use chessfriend_core::Color;
use std::fmt;
#[derive(Clone, Copy, Eq, Hash, PartialEq)]
@ -40,7 +41,8 @@ impl Default for Flags {
#[cfg(test)]
mod tests {
use super::*;
use crate::{r#move::Castle, Color};
use crate::r#move::Castle;
use chessfriend_core::Color;
#[test]
fn castle_flags() {

View file

@ -1,11 +1,7 @@
// Eryn Wells <eryn@erynwells.me>
use crate::{
piece::{Piece, PlacedPiece},
Color,
};
use chessfriend_bitboard::BitBoard;
use chessfriend_core::Square;
use chessfriend_core::{Color, Piece, PlacedPiece, Square};
#[derive(Debug, Eq, PartialEq)]
pub enum PlacePieceStrategy {

View file

@ -1,9 +1,8 @@
// Eryn Wells <eryn@erynwells.me>
use super::Position;
use crate::piece::{Color, Piece, PlacedPiece, Shape};
use chessfriend_bitboard::BitBoard;
use chessfriend_core::Square;
use chessfriend_core::{Color, Piece, PlacedPiece, Shape, Square};
pub struct Pieces<'a> {
color: Color,
@ -74,9 +73,8 @@ impl<'a> Iterator for Pieces<'a> {
#[cfg(test)]
mod tests {
use super::*;
use crate::piece::{Color, Piece, Shape};
use crate::{Position, PositionBuilder};
use chessfriend_core::{piece, Color};
use std::collections::HashSet;
#[test]

View file

@ -2,15 +2,14 @@
use super::{flags::Flags, piece_sets::PieceBitBoards, Pieces};
use crate::{
move_generator::Moves,
piece::{Color, Piece, PlacedPiece, Shape},
move_generator::{MoveSet, Moves},
position::DiagramFormatter,
r#move::Castle,
sight::Sight,
sight::SightExt,
Move,
};
use chessfriend_bitboard::BitBoard;
use chessfriend_core::Square;
use chessfriend_core::{Color, Piece, PlacedPiece, Shape, Square};
use std::{cell::OnceCell, fmt};
#[derive(Clone, Debug, Eq, PartialEq)]
@ -268,8 +267,8 @@ impl fmt::Display for Position {
#[cfg(test)]
mod tests {
use crate::{position, Castle, Color, Position};
use chessfriend_core::Square;
use crate::{position, test_position, Castle, Position};
use chessfriend_core::{piece, Color, Square};
#[test]
fn piece_on_square() {