diff --git a/game/gameloop.go b/game/gameloop.go index db35669..f31438b 100644 --- a/game/gameloop.go +++ b/game/gameloop.go @@ -82,10 +82,14 @@ func Gameloop(row, col int, Window fyne.Window) { // checking if the game has been won by the human player if gameControl.PlayerHasWon(board, PLAYER_X) { dialog.ShowInformation(gameOverText, "X has won!", Window) + DisableAllButtons(gridContainer) + return } // checking if the game is a draw if gameControl.BoardisFull(board) { dialog.ShowInformation(gameOverText, "It's a draw!", Window) + DisableAllButtons(gridContainer) + return } // AI opponent makes a move bestMove := opponent.Minimax(board, 0, true, PLAYER_O) @@ -97,11 +101,13 @@ func Gameloop(row, col int, Window fyne.Window) { if gameControl.PlayerHasWon(board, PLAYER_O) { dialog.ShowInformation(gameOverText, "O has won!", Window) DisableAllButtons(gridContainer) + return } // checking if the game is a draw if gameControl.BoardisFull(board) { dialog.ShowInformation(gameOverText, "It's a draw!", Window) DisableAllButtons(gridContainer) + return } }