From 8110985e6636e511f0a2e85a6f30aa8ff109320d Mon Sep 17 00:00:00 2001 From: tslil clingman <> Date: Sun, 19 Jan 2020 23:26:29 -0800 Subject: Parsing `by hand', gui in separate module --- src/game.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/game.rs') diff --git a/src/game.rs b/src/game.rs index 931a15f..057a307 100644 --- a/src/game.rs +++ b/src/game.rs @@ -82,10 +82,11 @@ pub enum Action { impl fmt::Display for Action { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - Action::Place(player, pos, stone) => write!(f, "{}{}{}", pos, player, stone), + Action::Place(_, pos, stone) => write!(f, "{}{}", stone, pos), Action::Move(_, pos, direction, drops) => write!( f, - "{}{}{}", + "{}{}{}{}", + drops.iter().map(|&d| d as u32).sum::(), pos, direction, drops.into_iter().map(|q| q.to_string()).collect::() @@ -244,6 +245,8 @@ enum TurnOrder { Normal, } +// TODO: Redo this logging story with Result<...,String> instead + pub struct Game where L: Fn(String), -- cgit v1.3.1