2 Commits
0.2 ... 0.3

Author SHA1 Message Date
cc87ad378e handle simple draw
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2019-11-01 21:54:37 +01:00
befc8128cd strip binary 2019-10-31 21:15:58 +01:00
2 changed files with 7 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ steps:
image: rust:1.38.0 image: rust:1.38.0
commands: commands:
- cargo install --path . --root . -f - cargo install --path . --root . -f
- strip bin/tictactoe
- tar cvzf ttt.tar.gz bin src Cargo.* - tar cvzf ttt.tar.gz bin src Cargo.*
when: when:
event: event:

View File

@@ -163,6 +163,7 @@ impl Board {
} }
//Diagonal winners require a full X pass //Diagonal winners require a full X pass
winner(&winners[2..4]) winner(&winners[2..4])
.or(Some(State::N).filter(|_| self.0.iter().filter(|s| *s == &State::N).count() == 0))
} }
} }
@@ -253,6 +254,11 @@ mod test {
Board::from_str("OXN,OON,XNO").unwrap().winner(), Board::from_str("OXN,OON,XNO").unwrap().winner(),
Some(State::O) Some(State::O)
); );
println!("{}", Board::from_str("XOX,OOX,OXO").unwrap());
assert_eq!(
Board::from_str("XOX,OOX,OXO").unwrap().winner(),
Some(State::N)
);
} }
#[test] #[test]