mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 10:54:51 +00:00
Removed System-Outs to clean up console
This commit is contained in:
@@ -49,7 +49,7 @@ public class GenericGameController<T extends TurnBasedGame<T>> implements GameCo
|
|||||||
this.gameThreadBehaviour.setOnSendMove((id, m) -> GlobalEventBus.postAsync(new NetworkEvents.SendMove(id, (short)translateMove(m))));
|
this.gameThreadBehaviour.setOnSendMove((id, m) -> GlobalEventBus.postAsync(new NetworkEvents.SendMove(id, (short)translateMove(m))));
|
||||||
|
|
||||||
// Tell thread how to update UI
|
// Tell thread how to update UI
|
||||||
this.gameThreadBehaviour.setOnUpdateUI(() -> Platform.runLater(() -> canvas.redraw(game.deepCopy())));
|
this.gameThreadBehaviour.setOnUpdateUI(() -> Platform.runLater(this::updateUI));
|
||||||
|
|
||||||
// Change scene to game view
|
// Change scene to game view
|
||||||
gameView = new GameView(null, null, null, gameType);
|
gameView = new GameView(null, null, null, gameType);
|
||||||
@@ -139,8 +139,6 @@ public class GenericGameController<T extends TurnBasedGame<T>> implements GameCo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateUI() {
|
public void updateUI() {
|
||||||
System.out.println("DRAWING GAME");
|
|
||||||
// Drawing game
|
|
||||||
canvas.redraw(game.deepCopy());
|
canvas.redraw(game.deepCopy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,12 +60,12 @@ public class LocalMultiplayerView extends ViewWidget {
|
|||||||
if (information.players[0].isHuman) {
|
if (information.players[0].isHuman) {
|
||||||
players[0] = new LocalPlayer<>(information.players[0].name);
|
players[0] = new LocalPlayer<>(information.players[0].name);
|
||||||
} else {
|
} else {
|
||||||
players[0] = new ArtificialPlayer<>(new MiniMaxAI<BitboardTicTacToe>(9), information.players[0].name);
|
players[0] = new ArtificialPlayer<>(new RandomAI<BitboardTicTacToe>(), "Random AI");
|
||||||
}
|
}
|
||||||
if (information.players[1].isHuman) {
|
if (information.players[1].isHuman) {
|
||||||
players[1] = new LocalPlayer<>(information.players[1].name);
|
players[1] = new LocalPlayer<>(information.players[1].name);
|
||||||
} else {
|
} else {
|
||||||
players[1] = new ArtificialPlayer<>(new RandomAI<BitboardTicTacToe>(), information.players[1].name);
|
players[1] = new ArtificialPlayer<>(new MiniMaxAI<BitboardTicTacToe>(9), "MiniMax AI");
|
||||||
}
|
}
|
||||||
if (AppSettings.getSettings().getTutorialFlag() && AppSettings.getSettings().getFirstTTT()) {
|
if (AppSettings.getSettings().getTutorialFlag() && AppSettings.getSettings().getFirstTTT()) {
|
||||||
new ShowEnableTutorialWidget(
|
new ShowEnableTutorialWidget(
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ public class MiniMaxAI<T extends TurnBasedGame<T>> extends AbstractAI<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
long chosenMove = bestMoves.get(random.nextInt(bestMoves.size()));
|
long chosenMove = bestMoves.get(random.nextInt(bestMoves.size()));
|
||||||
System.out.println("[DEBUG] Selected move: " + Long.toBinaryString(chosenMove) + " | score: " + bestScore);
|
|
||||||
return chosenMove;
|
return chosenMove;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,8 @@ public class RandomAI<T extends TurnBasedGame<T>> extends AbstractAI<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getMove(T game) {
|
public long getMove(T game) {
|
||||||
System.out.println("Getting move?");
|
|
||||||
long legalMoves = game.getLegalMoves();
|
long legalMoves = game.getLegalMoves();
|
||||||
int move = new Random().nextInt(Long.bitCount(legalMoves));
|
int move = new Random().nextInt(Long.bitCount(legalMoves));
|
||||||
System.out.println("Legal moves: " + Long.toBinaryString(legalMoves));
|
|
||||||
System.out.println("Playing: " + Long.toBinaryString(nthBitIndex(legalMoves, move)));
|
|
||||||
return nthBitIndex(legalMoves, move);
|
return nthBitIndex(legalMoves, move);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user