Files
3DChess/app/src/main/java/chess/SwingMain.java
Persson-dev 58f02f681c
All checks were successful
Linux arm64 / Build (push) Successful in 51s
rename GameAdapter
2025-05-06 11:53:26 +02:00

46 lines
1.4 KiB
Java

package chess;
import chess.ai.minimax.AlphaBetaAI;
import chess.ai.minimax.AlphaBetaConsolePrinter;
import chess.controller.CommandExecutor;
import chess.controller.commands.NewGameCommand;
import chess.controller.event.GameAdapter;
import chess.model.Color;
import chess.model.Game;
import chess.pgn.PgnExport;
import chess.view.audio.GameAudio;
import chess.view.simplerender.Window;
public class SwingMain {
public static void main(String[] args) {
Game game = new Game();
CommandExecutor commandExecutor = new CommandExecutor(game);
Window window = new Window(commandExecutor, true);
commandExecutor.addListener(window);
AlphaBetaAI ai = new AlphaBetaAI(commandExecutor, Color.Black, 5);
commandExecutor.addListener(ai);
AlphaBetaConsolePrinter aiResults = new AlphaBetaConsolePrinter(ai);
aiResults.connect();
// AI ai2 = new AlphaBetaAI(commandExecutor, Color.White, 5);
// commandExecutor.addListener(ai2);
// Window window2 = new Window(ai2.getSimulation(), false);
// ai2.getSimulation().addListener(window2);
commandExecutor.addListener(new GameAdapter(){
@Override
public void onGameEnd() {
System.out.println(PgnExport.exportGame(game));
}
});
commandExecutor.addListener(new GameAudio());
commandExecutor.executeCommand(new NewGameCommand());
}
}