diff options
Diffstat (limited to 'src/board/move_generation.rs')
-rw-r--r-- | src/board/move_generation.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/board/move_generation.rs b/src/board/move_generation.rs index 0735309..5a3650a 100644 --- a/src/board/move_generation.rs +++ b/src/board/move_generation.rs @@ -1,20 +1,22 @@ +use smallvec::SmallVec; use crate::{moves::{Move, MoveKind}, board::{color::Color, piece::Piece, CastlingSide}, bitboard::BitboardFns, square::Square}; use super::Board; +pub type MoveList = SmallVec<[Move; 128]>; impl Board { - pub fn generate_pseudolegal_moves(&self) -> Vec<Move> { - let mut result = Vec::new(); + pub fn generate_pseudolegal_moves(&self) -> MoveList { + let mut result = MoveList::new(); result.append(&mut self.generate_moves_core(true)); result.append(&mut self.generate_moves_core(false)); result } - fn generate_moves_core(&self, tactical_only: bool) -> Vec<Move> { + pub fn generate_moves_core(&self, tactical_only: bool) -> MoveList { let color = self.color(); let player_pieces = self.pieces_by_color(color); - let mut moves = Vec::with_capacity(256); + let mut moves = MoveList::new(); let empty = self.empty(); let targets = if tactical_only { |