most basic best move search

This commit is contained in:
Moritz 2025-11-14 23:32:52 +01:00
parent af2178abad
commit 9d527634eb
7 changed files with 105 additions and 4 deletions

View file

@ -1,4 +1,5 @@
use std::slice;
use std::ops::{Index, IndexMut};
use crate::square::Square;
use crate::board::PieceType;
use crate::square::SQUARES;
@ -103,6 +104,22 @@ impl MoveList {
}
}
impl Index<usize> for MoveList {
type Output = Move;
#[inline(always)]
fn index(&self, index: usize) -> &Self::Output {
&self.moves[..self.count][index]
}
}
impl IndexMut<usize> for MoveList {
#[inline(always)]
fn index_mut(&mut self, index: usize) -> &mut Self::Output {
&mut self.moves[..self.count][index]
}
}
pub struct UndoMove {
pub mv: Move,
pub captured_piece: Option<PieceType>,