summaryrefslogtreecommitdiffstats
path: root/examples/tictactoe.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/tictactoe.rs')
-rw-r--r--examples/tictactoe.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/examples/tictactoe.rs b/examples/tictactoe.rs
index 49444eb..c8ffdc5 100644
--- a/examples/tictactoe.rs
+++ b/examples/tictactoe.rs
@@ -23,12 +23,12 @@ fn main() {
print!("{} plays > ", current);
stdout.flush().unwrap();
stdin.read_line(&mut line).expect("Cannot read input");
- let i = match usize::from_str(line.trim()) {
- Ok(i) => i,
+ let i = match usize::from_str(line.trim()) {
+ Ok(i) => i,
_ => {
println!("Bad input");
continue;
- }
+ }
};
if i < 1 || i > 9 {
println!("Bad input, should be between 1 and 9");
@@ -57,14 +57,14 @@ fn main() {
}
fn get(table: &Table, x: usize, y: usize) -> String {
- match table.get_row(y) {
- Some(ref r) => {
- match r.get_cell(x) {
- Some(ref c) => c.to_string(),
- _ => EMPTY.to_string(),
+ match table.get_row(y) {
+ Some(r) => {
+ match r.get_cell(x) {
+ Some(c) => c.to_string(),
+ _ => EMPTY.to_string(),
}
- }
- _ => EMPTY.to_string(),
+ }
+ _ => EMPTY.to_string(),
}
}
@@ -94,5 +94,5 @@ fn check(table: &Table) -> bool {
if full {
println!("Game is over. It's a draw");
}
- return full;
+ full
}