monster_chess/games/chess/
process.rs

1use crate::board::{fen::PostProcess, Board};
2use super::pieces::PAWN;
3
4#[derive(Debug)]
5pub struct ChessPostProcess;
6impl<const T: usize> PostProcess<T> for ChessPostProcess {
7    fn apply(&self, board: &mut Board<T>) {
8        let cols = board.state.cols;
9        let edges = &board.state.edges[0];
10        let mut bottom = edges.bottom;
11        let mut top = edges.top;
12
13        bottom |= bottom.up(1, cols);
14        top |= top.down(1, cols);
15
16        let first_move = (board.state.pieces[PAWN] & board.state.teams[0] & bottom)
17            | (board.state.pieces[PAWN] & board.state.teams[1] & top)
18            | (board.state.all_pieces ^ board.state.pieces[PAWN]);
19        board.state.first_move &= first_move;
20    }
21}