Formatting

This commit is contained in:
lieght
2025-09-21 17:43:29 +02:00
parent 2238c6e6c9
commit 6ef4b44574
2 changed files with 3 additions and 4 deletions

View File

@@ -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 if (maximizing) { // it's the maximizing players turn, the AI
bestVal = -100; bestVal = -100;
for (int i = 0; i < game.grid.length; i++) { // loop through the grid for (int i = 0; i < game.grid.length; i++) { // loop through the grid

View File

@@ -2,13 +2,12 @@ package org.toop.game.tictactoe.ai;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
import java.util.Set;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.toop.game.tictactoe.GameBase; import org.toop.game.tictactoe.GameBase;
import org.toop.game.tictactoe.TicTacToe; import org.toop.game.tictactoe.TicTacToe;
import java.util.Set;
/** Unit tests for MinMaxTicTacToe AI. */ /** Unit tests for MinMaxTicTacToe AI. */
public class MinMaxTicTacToeTest { public class MinMaxTicTacToeTest {
@@ -78,7 +77,7 @@ public class MinMaxTicTacToeTest {
// On empty board, center (index 4) is strongest // On empty board, center (index 4) is strongest
int bestMove = ai.findBestMove(game); int bestMove = ai.findBestMove(game);
assertTrue(Set.of(0,2,6,8).contains(bestMove)); assertTrue(Set.of(0, 2, 6, 8).contains(bestMove));
} }
@Test @Test