[position] For non-King move generators, only generate moves if the push and captures masks aren't empty

Always generate King moves.
This commit is contained in:
Eryn Wells 2024-02-02 08:03:51 -08:00
parent 31903cb514
commit 986758d011
7 changed files with 35 additions and 26 deletions

View file

@ -6,15 +6,15 @@
use super::{move_generator_declaration, MoveGeneratorInternal, MoveSet};
use crate::{r#move::Castle, Position};
use chessfriend_bitboard::BitBoard;
use chessfriend_core::{Color, Piece, PlacedPiece};
use chessfriend_core::{PlacedPiece, Shape};
move_generator_declaration!(KingMoveGenerator, struct);
move_generator_declaration!(KingMoveGenerator, new);
move_generator_declaration!(KingMoveGenerator, getters);
impl MoveGeneratorInternal for KingMoveGenerator {
fn piece(color: Color) -> Piece {
Piece::king(color)
fn shape() -> Shape {
Shape::King
}
fn move_set_for_piece(
@ -59,7 +59,7 @@ mod tests {
use super::*;
use crate::{assert_move_list, position, test_position, Move, MoveBuilder, PositionBuilder};
use chessfriend_bitboard::bitboard;
use chessfriend_core::{piece, Square};
use chessfriend_core::{piece, Color, Square};
use std::collections::HashSet;
#[test]