[board] Remove the position reference from move generator structs
Simplifies the lifetime calculations, and makes it possible to cache a Moves object on Position.
This commit is contained in:
parent
d3ab477795
commit
bea6dd67c8
9 changed files with 25 additions and 28 deletions
|
@ -4,7 +4,7 @@
|
|||
//! generating the possible moves for the king in the given position.
|
||||
|
||||
use super::{move_generator_declaration, MoveGeneratorInternal, MoveSet};
|
||||
use crate::{ r#move::Castle, Move, MoveBuilder, Position};
|
||||
use crate::{r#move::Castle, Move, MoveBuilder, Position};
|
||||
use chessfriend_bitboard::BitBoard;
|
||||
use chessfriend_core::{Color, Piece, PlacedPiece};
|
||||
|
||||
|
@ -12,7 +12,7 @@ move_generator_declaration!(KingMoveGenerator, struct);
|
|||
move_generator_declaration!(KingMoveGenerator, new);
|
||||
move_generator_declaration!(KingMoveGenerator, getters);
|
||||
|
||||
impl<'a> KingMoveGenerator<'a> {
|
||||
impl KingMoveGenerator {
|
||||
#[allow(unused_variables)]
|
||||
fn king_side_castle(position: &Position, color: Color) -> Option<Move> {
|
||||
if !position.player_has_right_to_castle(color, Castle::KingSide) {
|
||||
|
@ -34,7 +34,7 @@ impl<'a> KingMoveGenerator<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'pos> MoveGeneratorInternal for KingMoveGenerator<'pos> {
|
||||
impl MoveGeneratorInternal for KingMoveGenerator {
|
||||
fn piece(color: Color) -> Piece {
|
||||
Piece::king(color)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue