Board::game_winner: remove unneeded argument

This commit is contained in:
2025-02-19 13:40:05 -05:00
parent 1061292409
commit 6f51c31752
3 changed files with 6 additions and 5 deletions

View File

@@ -324,10 +324,11 @@ impl Board {
}
/// Returns the winner of the board (if any)
pub fn game_winner(&self, turn: Piece) -> Winner {
pub fn game_winner(&self) -> Winner {
// Wikipedia: `Players take alternate turns. If one player cannot make a valid move, play passes back to the other player. The game ends when the grid has filled up or if neither player can make a valid move.`
if self.possible_moves(turn).next().is_some() || self.possible_moves(!turn).next().is_some()
if self.possible_moves(Piece::Black).next().is_some()
|| self.possible_moves(Piece::White).next().is_some()
{
// player can still make a move, there is no winner
return Winner::None;