This commit is contained in:
@@ -4,7 +4,7 @@ import chess.ai.minimax.AlphaBetaAI;
|
|||||||
import chess.ai.minimax.AlphaBetaConsolePrinter;
|
import chess.ai.minimax.AlphaBetaConsolePrinter;
|
||||||
import chess.controller.CommandExecutor;
|
import chess.controller.CommandExecutor;
|
||||||
import chess.controller.commands.NewGameCommand;
|
import chess.controller.commands.NewGameCommand;
|
||||||
import chess.controller.event.GameAdaptator;
|
import chess.controller.event.GameAdapter;
|
||||||
import chess.model.Color;
|
import chess.model.Color;
|
||||||
import chess.model.Game;
|
import chess.model.Game;
|
||||||
import chess.pgn.PgnExport;
|
import chess.pgn.PgnExport;
|
||||||
@@ -31,7 +31,7 @@ public class SwingMain {
|
|||||||
// Window window2 = new Window(ai2.getSimulation(), false);
|
// Window window2 = new Window(ai2.getSimulation(), false);
|
||||||
// ai2.getSimulation().addListener(window2);
|
// ai2.getSimulation().addListener(window2);
|
||||||
|
|
||||||
commandExecutor.addListener(new GameAdaptator(){
|
commandExecutor.addListener(new GameAdapter(){
|
||||||
@Override
|
@Override
|
||||||
public void onGameEnd() {
|
public void onGameEnd() {
|
||||||
System.out.println(PgnExport.exportGame(game));
|
System.out.println(PgnExport.exportGame(game));
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ import chess.controller.commands.GetPieceAtCommand;
|
|||||||
import chess.controller.commands.GetPlayerMovesCommand;
|
import chess.controller.commands.GetPlayerMovesCommand;
|
||||||
import chess.controller.commands.GetAllowedCastlingsCommand;
|
import chess.controller.commands.GetAllowedCastlingsCommand;
|
||||||
import chess.controller.commands.GetAllowedCastlingsCommand.CastlingResult;
|
import chess.controller.commands.GetAllowedCastlingsCommand.CastlingResult;
|
||||||
import chess.controller.event.GameAdaptator;
|
import chess.controller.event.GameAdapter;
|
||||||
import chess.model.Color;
|
import chess.model.Color;
|
||||||
import chess.model.Coordinate;
|
import chess.model.Coordinate;
|
||||||
import chess.model.Move;
|
import chess.model.Move;
|
||||||
import chess.model.Piece;
|
import chess.model.Piece;
|
||||||
|
|
||||||
public abstract class AI extends GameAdaptator{
|
public abstract class AI extends GameAdapter{
|
||||||
|
|
||||||
protected final CommandExecutor commandExecutor;
|
protected final CommandExecutor commandExecutor;
|
||||||
protected final Color color;
|
protected final Color color;
|
||||||
|
|||||||
@@ -13,14 +13,14 @@ import chess.controller.commands.PromoteCommand;
|
|||||||
import chess.controller.commands.UndoCommand;
|
import chess.controller.commands.UndoCommand;
|
||||||
import chess.controller.commands.PromoteCommand.PromoteType;
|
import chess.controller.commands.PromoteCommand.PromoteType;
|
||||||
import chess.controller.event.EmptyGameDispatcher;
|
import chess.controller.event.EmptyGameDispatcher;
|
||||||
import chess.controller.event.GameAdaptator;
|
import chess.controller.event.GameAdapter;
|
||||||
import chess.model.ChessBoard;
|
import chess.model.ChessBoard;
|
||||||
import chess.model.Color;
|
import chess.model.Color;
|
||||||
import chess.model.Game;
|
import chess.model.Game;
|
||||||
import chess.model.Move;
|
import chess.model.Move;
|
||||||
import chess.model.PermissiveGame;
|
import chess.model.PermissiveGame;
|
||||||
|
|
||||||
public class GameSimulation extends GameAdaptator {
|
public class GameSimulation extends GameAdapter {
|
||||||
|
|
||||||
private final CommandExecutor simulation;
|
private final CommandExecutor simulation;
|
||||||
private final Game gameSimulation;
|
private final Game gameSimulation;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import chess.model.Color;
|
|||||||
import chess.model.Coordinate;
|
import chess.model.Coordinate;
|
||||||
import chess.model.Move;
|
import chess.model.Move;
|
||||||
|
|
||||||
public abstract class GameAdaptator implements GameListener {
|
public abstract class GameAdapter implements GameListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerTurn(Color color, boolean undone) {}
|
public void onPlayerTurn(Color color, boolean undone) {}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package chess.controller.event;
|
package chess.controller.event;
|
||||||
|
|
||||||
public abstract class GameDispatcher extends GameAdaptator {
|
public abstract class GameDispatcher extends GameAdapter {
|
||||||
|
|
||||||
public abstract void addListener(GameListener listener);
|
public abstract void addListener(GameListener listener);
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class PgnExport {
|
|||||||
// DumbAI ai2 = new DumbAI(commandExecutor, Color.Black);
|
// DumbAI ai2 = new DumbAI(commandExecutor, Color.Black);
|
||||||
// commandExecutor.addListener(ai2);
|
// commandExecutor.addListener(ai2);
|
||||||
|
|
||||||
// commandExecutor.addListener(new GameAdaptator() {
|
// commandExecutor.addListener(new GameAdapter() {
|
||||||
// @Override
|
// @Override
|
||||||
// public void onGameEnd() {
|
// public void onGameEnd() {
|
||||||
// System.out.println(exportGame(game));
|
// System.out.println(exportGame(game));
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import java.util.List;
|
|||||||
|
|
||||||
import chess.controller.CommandExecutor;
|
import chess.controller.CommandExecutor;
|
||||||
import chess.controller.PlayerCommand;
|
import chess.controller.PlayerCommand;
|
||||||
import chess.controller.event.GameAdaptator;
|
import chess.controller.event.GameAdapter;
|
||||||
import common.Signal0;
|
import common.Signal0;
|
||||||
|
|
||||||
public class PgnSimulator extends GameAdaptator {
|
public class PgnSimulator extends GameAdapter {
|
||||||
|
|
||||||
private final CommandExecutor commandExecutor;
|
private final CommandExecutor commandExecutor;
|
||||||
private final String pgn;
|
private final String pgn;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package chess.view.audio;
|
package chess.view.audio;
|
||||||
|
|
||||||
import chess.controller.commands.PromoteCommand.PromoteType;
|
import chess.controller.commands.PromoteCommand.PromoteType;
|
||||||
import chess.controller.event.GameAdaptator;
|
import chess.controller.event.GameAdapter;
|
||||||
import chess.model.Move;
|
import chess.model.Move;
|
||||||
|
|
||||||
public class GameAudio extends GameAdaptator {
|
public class GameAudio extends GameAdapter {
|
||||||
|
|
||||||
private final boolean functional;
|
private final boolean functional;
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import chess.controller.Command;
|
|||||||
import chess.controller.CommandExecutor;
|
import chess.controller.CommandExecutor;
|
||||||
import chess.controller.commands.NewGameCommand;
|
import chess.controller.commands.NewGameCommand;
|
||||||
import chess.controller.commands.UndoCommand;
|
import chess.controller.commands.UndoCommand;
|
||||||
import chess.controller.event.GameAdaptator;
|
import chess.controller.event.GameAdapter;
|
||||||
import chess.model.Color;
|
import chess.model.Color;
|
||||||
import chess.model.Game;
|
import chess.model.Game;
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ class AppTest {
|
|||||||
DumbAI ai2 = new DumbAI(commandExecutor, Color.White);
|
DumbAI ai2 = new DumbAI(commandExecutor, Color.White);
|
||||||
commandExecutor.addListener(ai2);
|
commandExecutor.addListener(ai2);
|
||||||
|
|
||||||
commandExecutor.addListener(new GameAdaptator() {
|
commandExecutor.addListener(new GameAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void onGameEnd() {
|
public void onGameEnd() {
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import chess.ai.DumbAI;
|
|||||||
import chess.controller.CommandExecutor;
|
import chess.controller.CommandExecutor;
|
||||||
import chess.controller.PlayerCommand;
|
import chess.controller.PlayerCommand;
|
||||||
import chess.controller.commands.NewGameCommand;
|
import chess.controller.commands.NewGameCommand;
|
||||||
import chess.controller.event.GameAdaptator;
|
import chess.controller.event.GameAdapter;
|
||||||
import chess.model.Color;
|
import chess.model.Color;
|
||||||
import chess.model.Game;
|
import chess.model.Game;
|
||||||
import chess.pgn.PgnExport;
|
import chess.pgn.PgnExport;
|
||||||
@@ -27,7 +27,7 @@ public class PgnTest {
|
|||||||
commandExecutor.addListener(new DumbAI(commandExecutor, Color.White));
|
commandExecutor.addListener(new DumbAI(commandExecutor, Color.White));
|
||||||
commandExecutor.addListener(new DumbAI(commandExecutor, Color.Black));
|
commandExecutor.addListener(new DumbAI(commandExecutor, Color.Black));
|
||||||
|
|
||||||
commandExecutor.addListener(new GameAdaptator() {
|
commandExecutor.addListener(new GameAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void onGameEnd() {
|
public void onGameEnd() {
|
||||||
synchronized (game) {
|
synchronized (game) {
|
||||||
|
|||||||
Reference in New Issue
Block a user