pub const BOARD_SIZE: usize = 128;
pub const COLOR_MASK: u8 = 128; pub const WHITE_PAWN_DELTAS: [i8; 4] = [-16, -32, -17, -15];
pub const BLACK_PAWN_DELTAS: [i8; 4] = [16, 32, 17, 15];
pub const BISHOP_DELTAS: [i8; 4] = [17, 15, -17, -15];
pub const ROOK_DELTAS: [i8; 4] = [16, -16, 1, -1];
pub const QUEEN_DELTAS: [i8; 8] = [16, -16, 1, -1, 17, 15, -17, -15];
pub const KNIGHT_DELTAS: [i8; 8] = [14, 31, 18, 33, -14, -31, -18, -33];
pub const KING_DELTAS: [i8; 10] = [1, 16, 17, 15, -1, -16, -17, -15, 2, -2];
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Color {
WHITE = 0,
BLACK = 128,
}
impl Color {
pub fn to_value(&self) -> u8 {
*self as u8
}
pub fn to_string(&self) -> String {
if self.to_value() == 0 {
return String::from("w");
} else {
return String::from("b");
}
}
}
#[rustfmt::skip]
pub const ATTACKS: [u8; 239] = [
20, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0,20, 0,
0,20, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0,20, 0, 0,
0, 0,20, 0, 0, 0, 0, 24, 0, 0, 0, 0,20, 0, 0, 0,
0, 0, 0,20, 0, 0, 0, 24, 0, 0, 0,20, 0, 0, 0, 0,
0, 0, 0, 0,20, 0, 0, 24, 0, 0,20, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,20, 2, 24, 2,20, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 2,53, 56, 53, 2, 0, 0, 0, 0, 0, 0, 24,24,24,24,24,24,56, 0, 56,24,24,24,24,24,24, 0, 0, 0, 0, 0, 0, 2,181,56,181, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,20, 2, 24, 2,20, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0,20, 0, 0, 24, 0, 0,20, 0, 0, 0, 0, 0,
0, 0, 0,20, 0, 0, 0, 24, 0, 0, 0,20, 0, 0, 0, 0,
0, 0,20, 0, 0, 0, 0, 24, 0, 0, 0, 0,20, 0, 0, 0,
0,20, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0,20, 0, 0,
20, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0,20
];
pub const BOARD_MAP: [u8; 64] = [
0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23, 32, 33, 34, 35, 36, 37, 38, 39, 48, 49,
50, 51, 52, 53, 54, 55, 64, 65, 66, 67, 68, 69, 70, 71, 80, 81, 82, 83, 84, 85, 86, 87, 96, 97,
98, 99, 100, 101, 102, 103, 112, 113, 114, 115, 116, 117, 118, 119,
];
pub const FILES: [&str; 8] = ["a", "b", "c", "d", "e", "f", "g", "h"];