Skip to main content

hive/engine/game/
action.rs

1use std::fmt::{Display, Formatter, Result};
2
3use crate::engine::grid::{coordinate::hex::Hex, piece::Piece};
4
5#[derive(Debug, PartialEq, Clone, Copy)]
6pub struct Action {
7  pub piece: Piece,
8  pub from: Hex,
9  pub to: Hex,
10  pub in_hand: bool,
11  pub is_pillbug_special_move: bool,
12}
13
14impl Display for Action {
15  fn fmt(&self, f: &mut Formatter) -> Result {
16    if self.in_hand {
17      write!(f, "{} from: HAND, to: {}", self.piece, self.to)
18    } else {
19      write!(f, "{} from: {}, to: {}", self.piece, self.from, self.to)
20    }
21  }
22}