mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 19:04:49 +00:00
fix: some small issues
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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!");
|
||||
|
||||
Reference in New Issue
Block a user