mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 10:54:51 +00:00
Formatting
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user