fix: some small issues

This commit is contained in:
ramollia
2025-09-17 15:42:39 +02:00
parent 6c0dd220a4
commit 5a8840a789
10 changed files with 10 additions and 199 deletions

View File

@@ -121,10 +121,6 @@ public class ConsoleGui {
int move = -1;
if (ai1 != null && current.name() == ai1 || ai2 != null && current.name() == ai2) {
try {
Thread.sleep(2000);
} catch (Exception e) {}
move = ai.findBestMove(game);
} else {
System.out.printf("%s's (%c) turn. Please choose an empty cell between 0-8: ", current.name(), current.move());

View File

@@ -53,16 +53,14 @@ public class Main {
// GlobalEventBus.post(new Events.ServerEvents.Command(connectionId, "MOVE", "" + x));
// }
// ConsoleGui console = new ConsoleGui();
// GameBase.State state = GameBase.State.INVALID;
//
// console.print();
//
// do {
// console.print();
// } while (console.next());
//
// console.print();
ConsoleGui console = new ConsoleGui();
GameBase.State state = GameBase.State.INVALID;
do {
console.print();
} while (console.next());
console.print();
}
public static void initSystems() {

View File

@@ -1,4 +1,3 @@
import org.junit.jupiter.api.Test;
import org.toop.game.tictactoe.*;
@@ -53,7 +52,7 @@ class MinMaxTicTacToeTest {
@Test
void testMinimax_ScoreLoss() {
TicTacToe game = makeGame("OOO ", 1);
TicTacToe game = makeGame("OOO------", 1);
MinMaxTicTacToe ai = new MinMaxTicTacToe();
int score = ai.doMinimax(game, 5, true);
assertTrue(score < 0, "AI loss is negative");
@@ -69,7 +68,7 @@ class MinMaxTicTacToeTest {
@Test
void testMiniMax_MultipleMoves() {
TicTacToe game = makeGame(" X-OX--O-", 0);
TicTacToe game = makeGame("-X-OX--O-", 0);
MinMaxTicTacToe ai = new MinMaxTicTacToe();
int bestMove = ai.findBestMove(game);
assertTrue(bestMove == 0 || bestMove == 2, "Can look at multiple moves!");