variable board size
This commit is contained in:
parent
fac96e2329
commit
2b5af0c09b
@ -127,11 +127,11 @@ fn main() {
|
||||
for s in &[State::X, State::O] {
|
||||
loop {
|
||||
let (x, y) = loop {
|
||||
print!("{}, your move: (x, y) ", s);
|
||||
print!("{}, your move: (x y) ", s);
|
||||
io::stdout().flush();
|
||||
input.clear();
|
||||
stdin.read_line(&mut input);
|
||||
let parts = input.trim().split(",").collect::<Vec<_>>();
|
||||
let parts = input.trim().split(" ").collect::<Vec<_>>();
|
||||
match (parts[0].parse::<usize>(), parts[1].parse::<usize>()) {
|
||||
(Err(_), _) => eprintln!("X is not an valid int"),
|
||||
(_, Err(_)) => eprintln!("Y is not an valid int"),
|
||||
@ -154,6 +154,9 @@ fn main() {
|
||||
_ => eprintln!("({}, {}) is already occupied! Try again", x, y),
|
||||
}
|
||||
}
|
||||
if let Some(winner) = board.winner() {
|
||||
break;
|
||||
}
|
||||
println!("{}", &board);
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user