aboutsummaryrefslogtreecommitdiff
path: root/src/moves.rs
blob: 87b7c4b4e8ca402d659d0719fa9bb37af8853ce5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use crate::{square::Square, bitboard::print, board::PieceType};

#[derive(Debug, Clone, PartialEq, Eq, Copy)]
pub enum MoveKind {
    Quiet,
    Capture,
    Castle,
    EnPassant,
    DoublePush,
    Promotion(PieceType),
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Move {
    pub source: Square,
    pub target: Square,
    pub kind: MoveKind,
}

impl Move {
    pub fn print(&self) {
        let bb = self.source.to_bitboard() | self.target.to_bitboard();
        print(bb, format!("{:?}", self).as_str());
    }
}



#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn mock() {
        let mov = Move { source: Square::E2, target: Square::E4, kind: MoveKind::Quiet };
        println!("{:?}", mov);
    }
}