|
|
@ -53,29 +53,44 @@ impl Default for Game { |
|
|
|
|
|
|
|
|
|
|
|
impl Display for Game { |
|
|
|
impl Display for Game { |
|
|
|
fn fmt(&self, f : &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
fn fmt(&self, f : &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
write!(f, " ")?; |
|
|
|
for n in (13..=24) { |
|
|
|
for n in (13..=24) { write!(f, " {:2}", n)?; } |
|
|
|
write!(f, "{} ", ('D' as u8 + (n - 13) as u8) as char)?; |
|
|
|
write!(f, "\n╭")?; |
|
|
|
} |
|
|
|
|
|
|
|
write!(f, "\n")?; |
|
|
|
|
|
|
|
|
|
|
|
for b in &self.bins[12..=23] { |
|
|
|
for (i, b) in (&self.bins[12..=23]).iter().enumerate() { |
|
|
|
match *b { |
|
|
|
match *b { |
|
|
|
Bin::Empty => write!(f, " ┈┈")?, |
|
|
|
Bin::Empty => { |
|
|
|
Bin::Black(n) => write!(f, "{:2}#", n)?, |
|
|
|
if i%2==0 { |
|
|
|
Bin::White(n) => write!(f, "{:2}:", n)? |
|
|
|
write!(f, "░░")? |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
write!(f, "▒▒")? |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
Bin::Black(n) => write!(f, "{:X}#", n)?, |
|
|
|
|
|
|
|
Bin::White(n) => write!(f, "{:X}:", n)? |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
write!(f, " > {}:\n╰", self.players[Side::Black as usize].born_off)?; |
|
|
|
write!(f, "|:{}\n", self.players[Side::Black as usize].born_off)?; |
|
|
|
|
|
|
|
|
|
|
|
for b in (&self.bins[0..=11]).iter().rev() { |
|
|
|
for (i, b) in (&self.bins[0..=11]).iter().rev().enumerate() { |
|
|
|
match *b { |
|
|
|
match *b { |
|
|
|
Bin::Empty => write!(f, " ┈┈")?, |
|
|
|
Bin::Empty => { |
|
|
|
Bin::Black(n) => write!(f, "{:2}#", n)?, //█
|
|
|
|
if i%2==0 { |
|
|
|
Bin::White(n) => write!(f, "{:2}:", n)? //░
|
|
|
|
write!(f, "░░")? |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
write!(f, "▒▒")? |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
Bin::Black(n) => write!(f, "{:X}#", n)?, //█
|
|
|
|
|
|
|
|
Bin::White(n) => write!(f, "{:X}:", n)? //░
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
write!(f, " > {}#\n ", self.players[Side::Black as usize].born_off)?; |
|
|
|
write!(f, "|#{}\n", self.players[Side::Black as usize].born_off)?; |
|
|
|
for n in (1..=12).rev() { write!(f, " {:2}", n)?; } |
|
|
|
for n in (1..=12).rev() { |
|
|
|
|
|
|
|
write!(f, "{:X} ", n)?; |
|
|
|
|
|
|
|
} |
|
|
|
write!(f, "\n")?; |
|
|
|
write!(f, "\n")?; |
|
|
|
|
|
|
|
|
|
|
|
Ok(()) |
|
|
|
Ok(()) |
|
|
|