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