othello_agent/gameplay/
types.rs

1pub type IBoard = [[IPiece; 8]; 8];
2
3// this type can be 0,1,2
4pub type IPiece = u8;
5
6pub type IPlayer = u8;
7
8#[allow(dead_code)]
9pub struct IGameAttrs {
10    pub board_str: String,
11    pub last_piece_str: String,
12    pub turn_str: String,
13}
14
15#[allow(dead_code)]
16pub struct IPosition {
17    // can also represent a vector movement
18    pub rightwards: i8,
19    pub downwards: i8,
20}
21
22impl IPosition {
23    // add another position to this position
24    pub fn add(&mut self, other: IPosition) {
25        self.rightwards += other.rightwards;
26        self.downwards += other.downwards;
27    }
28
29    // duplicate this position
30    pub fn duplicate(&self) -> IPosition {
31        IPosition {
32            rightwards: self.rightwards,
33            downwards: self.downwards,
34        }
35    }
36}
37
38pub type IPositionOption = Option<IPosition>;