diff --git a/src/main/java/org/toop/game/tictactoe/ai/MinMaxTicTacToe.java b/src/main/java/org/toop/game/tictactoe/ai/MinMaxTicTacToe.java index 7d41728..dd97b96 100644 --- a/src/main/java/org/toop/game/tictactoe/ai/MinMaxTicTacToe.java +++ b/src/main/java/org/toop/game/tictactoe/ai/MinMaxTicTacToe.java @@ -104,7 +104,7 @@ public class MinMaxTicTacToe { } } - int bestVal;// set the value to the highest possible + int bestVal; // set the value to the highest possible if (maximizing) { // it's the maximizing players turn, the AI bestVal = -100; for (int i = 0; i < game.grid.length; i++) { // loop through the grid diff --git a/src/test/java/org/toop/game/tictactoe/ai/MinMaxTicTacToeTest.java b/src/test/java/org/toop/game/tictactoe/ai/MinMaxTicTacToeTest.java index 2e3e15c..9c2e0be 100644 --- a/src/test/java/org/toop/game/tictactoe/ai/MinMaxTicTacToeTest.java +++ b/src/test/java/org/toop/game/tictactoe/ai/MinMaxTicTacToeTest.java @@ -2,13 +2,12 @@ package org.toop.game.tictactoe.ai; import static org.junit.jupiter.api.Assertions.*; +import java.util.Set; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.toop.game.tictactoe.GameBase; import org.toop.game.tictactoe.TicTacToe; -import java.util.Set; - /** Unit tests for MinMaxTicTacToe AI. */ public class MinMaxTicTacToeTest { @@ -78,7 +77,7 @@ public class MinMaxTicTacToeTest { // On empty board, center (index 4) is strongest int bestMove = ai.findBestMove(game); - assertTrue(Set.of(0,2,6,8).contains(bestMove)); + assertTrue(Set.of(0, 2, 6, 8).contains(bestMove)); } @Test