most basic best move search
This commit is contained in:
parent
af2178abad
commit
9d527634eb
7 changed files with 105 additions and 4 deletions
17
src/move.rs
17
src/move.rs
|
|
@ -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>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue