Implement the basic rules of Go #40

Merged
savanni merged 13 commits from feature/go-rules into main 2023-05-04 02:34:40 +00:00
2 changed files with 16 additions and 8 deletions
Showing only changes of commit e746190a4a - Show all commits

View File

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

View File

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