46 lines
1.4 KiB
Java
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());
|
|
}
|
|
}
|