summaryrefslogtreecommitdiff
path: root/src/game.rs
diff options
context:
space:
mode:
authortslil clingman <>2020-01-19 23:26:29 -0800
committertslil clingman <>2020-01-19 23:26:29 -0800
commit8110985e6636e511f0a2e85a6f30aa8ff109320d (patch)
tree7e6c1b38d04db474aac5cdac2593878f167cac8a /src/game.rs
parent4d18fad08c185e07d030f6574963ec6de8441ee5 (diff)
Parsing `by hand', gui in separate module
Diffstat (limited to 'src/game.rs')
-rw-r--r--src/game.rs7
1 files changed, 5 insertions, 2 deletions
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::<u32>(),
pos,
direction,
drops.into_iter().map(|q| q.to_string()).collect::<String>()
@@ -244,6 +245,8 @@ enum TurnOrder {
Normal,
}
+// TODO: Redo this logging story with Result<...,String> instead
+
pub struct Game<L>
where
L: Fn(String),