Add coordinates to the board printout

This commit is contained in:
Savanni D'Gerinel 2023-04-27 19:13:06 -04:00
parent 300704297f
commit e746190a4a
2 changed files with 16 additions and 8 deletions

View File

@ -38,6 +38,7 @@
pkgs.pkg-config pkgs.pkg-config
pkgs.sqlite pkgs.sqlite
pkgs.rustup pkgs.rustup
pkgs.cargo-nextest
pkgs.crate2nix pkgs.crate2nix
]; ];
LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib"; LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib";

View File

@ -170,7 +170,17 @@ pub struct Board {
impl std::fmt::Display for Board { impl std::fmt::Display for Board {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
print!(" ");
for c in 'A'..'U' {
if c == 'I' {
continue;
}
print!(" {}", c);
}
println!("");
for row in 0..self.size.height { for row in 0..self.size.height {
print!(" {:2}", row);
for column in 0..self.size.width { for column in 0..self.size.width {
match self.stone(Coordinate { column, row }) { match self.stone(Coordinate { column, row }) {
None => write!(f, " .")?, None => write!(f, " .")?,
@ -366,6 +376,8 @@ mod test {
] ]
.into_iter(), .into_iter(),
); );
println!("{}", board);
assert!(false);
let test_cases = vec![ let test_cases = vec![
( (
board.clone(), board.clone(),
@ -458,25 +470,20 @@ mod test {
liberties liberties
); );
} }
}
fn surrounding_a_stone_removes_it() {
assert!(false); assert!(false);
} }
#[test]
fn surrounding_a_stone_remove_it() {
assert!(false);
}
#[test]
fn sorrounding_a_group_removes_it() { fn sorrounding_a_group_removes_it() {
assert!(false); assert!(false);
} }
#[test]
fn suicide_is_forbidden() { fn suicide_is_forbidden() {
assert!(false); assert!(false);
} }
#[test]
fn captures_preceed_self_capture() { fn captures_preceed_self_capture() {
assert!(false); assert!(false);
} }