[position, board] Remove a bunch of dead code
This commit is contained in:
parent
039fd2b080
commit
7c9c5484ba
4 changed files with 0 additions and 118 deletions
|
@ -1,8 +1,5 @@
|
|||
// Eryn Wells <eryn@erynwells.me>
|
||||
|
||||
mod check;
|
||||
mod display;
|
||||
mod move_generator;
|
||||
mod movement;
|
||||
mod position;
|
||||
mod sight;
|
||||
|
|
|
@ -13,7 +13,6 @@ use std::{cell::OnceCell, fmt, ops::BitOr};
|
|||
#[derive(Clone, Debug, Eq)]
|
||||
pub struct Position {
|
||||
pub board: Board,
|
||||
moves: OnceCell<Moves>,
|
||||
pub(super) captures: [Vec<Piece>; Color::NUM],
|
||||
}
|
||||
|
||||
|
@ -145,18 +144,6 @@ impl Position {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn has_en_passant_square(&self) -> bool {
|
||||
self.board.en_passant().is_some()
|
||||
}
|
||||
|
||||
pub fn en_passant(&self) -> Option<EnPassant> {
|
||||
self.board.en_passant()
|
||||
}
|
||||
|
||||
fn _en_passant_target_square(&self) -> Option<Square> {
|
||||
self.board.en_passant().map(EnPassant::target_square)
|
||||
}
|
||||
|
||||
pub(crate) fn moves_for_piece(&self, piece: &PlacedPiece) -> Option<&MoveSet> {
|
||||
self.moves().moves_for_piece(piece)
|
||||
}
|
||||
|
@ -237,7 +224,6 @@ impl Default for Position {
|
|||
fn default() -> Self {
|
||||
Self {
|
||||
board: Board::default(),
|
||||
moves: OnceCell::new(),
|
||||
captures: Default::default(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
// Eryn Wells <eryn@erynwells.me>
|
||||
|
||||
use chessfriend_bitboard::BitBoard;
|
||||
use chessfriend_core::{Direction, Square};
|
||||
|
||||
fn _find_ray_connecting_squares(origin_square: Square, target_square: Square) -> BitBoard {
|
||||
macro_rules! ray {
|
||||
($square:expr, $direction:expr) => {
|
||||
($direction, BitBoard::ray($square, $direction))
|
||||
};
|
||||
}
|
||||
|
||||
let target: BitBoard = target_square.into();
|
||||
match Direction::ALL
|
||||
.iter()
|
||||
.map(|direction| ray!(origin_square, *direction))
|
||||
.find(|(direction, &ray)| (ray & target).is_populated())
|
||||
{
|
||||
Some((direction, ray)) => {
|
||||
if let Some(first_occupied_square) = BitBoard::$occupied_squares(&(ray & $blockers)).next()
|
||||
let remainder = BitBoard::ray(first_occupied_square, direction);
|
||||
let attack_ray = ray & !remainder;
|
||||
attack_ray * ray
|
||||
}
|
||||
None => BitBoard::EMPTY,
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue