So I have this code and for some reason the compiler complains that my input is unused? Is it possible to rewrite it somehow or am I missing something?
fn place_piece(&mut self) {
let mut input = 0;
loop {
input = get_input();
if input > 8 {
println!("The number must be between 1 and 9");
continue;
}
if self.taken_slots[input] != 0 {
println!("There's already a piece at {} \nTry Again...", input);
} else {
break;
}
}
match self.turn {
Turn::Player1 => {
self.taken_slots[input] = 1;
self.p1_value *= PIECE_VALUE[input];
self.turn = Turn::Player2
}
Turn::Player2 => {
self.taken_slots[input] = 2;
self.p2_value *= PIECE_VALUE[input];
self.turn = Turn::Player1
}
}
println!("Placed a piece at: {}", input + 1);
}
Oh and my get_input function just returns a usize number