diff --git a/src/main.rs b/src/main.rs index 4f50876..0a718a7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -141,7 +141,8 @@ impl Board { } /// instead of scanning all the board, checks input "win" combinaison - fn check_win(&self, item: Item, idx: usize) -> bool { + fn check_win(&self, player: Player, idx: usize) -> bool { + let item = player.item; match idx { 0 => { self.check_first_col(item) @@ -451,7 +452,7 @@ impl TicTacToe { } // check after the 5th round if there's a winner - if self.turn > 4 && self.board.check_win(player.item, item_position - 1) { + if self.turn > 4 && self.board.check_win(player, item_position - 1) { info(format!("{} wins!", item_icon)); self.board.show(); break;