use crate::move_type::{HighCard, MoveType};
pub const MAX_DEPTH: usize = 50;
#[derive(Clone, Copy, Debug)]
pub struct Pos {
pub rank_in_suit: [[u16; 4]; 4],
pub aggr: [u16; 4],
pub length: [[u8; 4]; 4],
pub hand_dist: [i32; 4],
pub win_ranks: [[u16; 4]; MAX_DEPTH],
pub first: [i32; MAX_DEPTH],
pub move_history: [MoveType; MAX_DEPTH],
pub tricks_max: i32,
pub winner: [HighCard; 4],
pub second_best: [HighCard; 4],
}
impl Default for Pos {
fn default() -> Self {
Self {
rank_in_suit: [[0; 4]; 4],
aggr: [0; 4],
length: [[0; 4]; 4],
hand_dist: [0; 4],
win_ranks: [[0; 4]; MAX_DEPTH],
first: [0; MAX_DEPTH],
move_history: [MoveType::default(); MAX_DEPTH],
tricks_max: 0,
winner: [HighCard::default(); 4],
second_best: [HighCard::default(); 4],
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn default_is_zero() {
let p = Pos::default();
assert_eq!(p.rank_in_suit, [[0; 4]; 4]);
assert_eq!(p.aggr, [0; 4]);
assert_eq!(p.tricks_max, 0);
}
}