class documentation - a shitload of it
All checks were successful
Linux arm64 / Build (push) Successful in 33s
All checks were successful
Linux arm64 / Build (push) Successful in 33s
This commit is contained in:
@@ -4,6 +4,15 @@ import java.util.Scanner;
|
|||||||
|
|
||||||
import chess.view.consolerender.Colors;
|
import chess.view.consolerender.Colors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main class of the chess game. Asks the user for the version to use and runs the according main.
|
||||||
|
* @author Grenier Lilas
|
||||||
|
* @author Pribylski Simon
|
||||||
|
* @see ConsoleMain
|
||||||
|
* @see SwingMain
|
||||||
|
* @see OpenGLMain
|
||||||
|
*/
|
||||||
|
|
||||||
public class App {
|
public class App {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println(Colors.RED + "Credits: Grenier Lilas, Pribylski Simon." + Colors.RESET);
|
System.out.println(Colors.RED + "Credits: Grenier Lilas, Pribylski Simon." + Colors.RESET);
|
||||||
|
|||||||
@@ -3,6 +3,9 @@
|
|||||||
*/
|
*/
|
||||||
package chess;
|
package chess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main class for the console version of the game.
|
||||||
|
*/
|
||||||
import chess.controller.CommandExecutor;
|
import chess.controller.CommandExecutor;
|
||||||
import chess.controller.commands.NewGameCommand;
|
import chess.controller.commands.NewGameCommand;
|
||||||
import chess.model.Game;
|
import chess.model.Game;
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import chess.model.Game;
|
|||||||
import chess.pgn.PgnFileSimulator;
|
import chess.pgn.PgnFileSimulator;
|
||||||
import chess.view.DDDrender.DDDView;
|
import chess.view.DDDrender.DDDView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main class for the 3D Window version of the game.
|
||||||
|
*/
|
||||||
public class OpenGLMain {
|
public class OpenGLMain {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Game game = new Game();
|
Game game = new Game();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package chess;
|
package chess;
|
||||||
|
|
||||||
import chess.ai.minimax.AlphaBetaAI;
|
import chess.ai.ais.AlphaBetaAI;
|
||||||
import chess.ai.minimax.AlphaBetaConsolePrinter;
|
import chess.ai.alphabeta.AlphaBetaConsolePrinter;
|
||||||
import chess.controller.CommandExecutor;
|
import chess.controller.CommandExecutor;
|
||||||
import chess.controller.commands.NewGameCommand;
|
import chess.controller.commands.NewGameCommand;
|
||||||
import chess.controller.event.GameAdapter;
|
import chess.controller.event.GameAdapter;
|
||||||
@@ -11,6 +11,9 @@ import chess.pgn.PgnExport;
|
|||||||
import chess.view.audio.GameAudio;
|
import chess.view.audio.GameAudio;
|
||||||
import chess.view.simplerender.Window;
|
import chess.view.simplerender.Window;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main class for the 2D window version of the game.
|
||||||
|
*/
|
||||||
public class SwingMain {
|
public class SwingMain {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Game game = new Game();
|
Game game = new Game();
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ import chess.model.Color;
|
|||||||
import chess.model.Coordinate;
|
import chess.model.Coordinate;
|
||||||
import chess.model.Piece;
|
import chess.model.Piece;
|
||||||
|
|
||||||
public abstract class AI extends GameAdapter {
|
/**
|
||||||
|
* Abstract class, used to code bots.
|
||||||
|
*/
|
||||||
|
public abstract class AI extends GameAdapter implements AIActions {
|
||||||
|
|
||||||
protected final CommandExecutor commandExecutor;
|
protected final CommandExecutor commandExecutor;
|
||||||
protected final Color color;
|
protected final Color color;
|
||||||
@@ -30,12 +33,9 @@ public abstract class AI extends GameAdapter {
|
|||||||
play();
|
play();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<AIAction> getAllowedActions() {
|
@Override
|
||||||
return AIActions.getAllowedActions(this.commandExecutor);
|
public CommandExecutor getCommandExecutor() {
|
||||||
}
|
return this.commandExecutor;
|
||||||
|
|
||||||
protected Piece pieceAt(Coordinate coordinate) {
|
|
||||||
return AIActions.pieceAt(coordinate, this.commandExecutor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package chess.ai.minimax;
|
package chess.ai;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -14,15 +14,19 @@ import chess.model.Color;
|
|||||||
import chess.model.Coordinate;
|
import chess.model.Coordinate;
|
||||||
import chess.model.Game;
|
import chess.model.Game;
|
||||||
import chess.model.Move;
|
import chess.model.Move;
|
||||||
import chess.model.PermissiveGame;
|
import chess.model.LightGame;
|
||||||
|
|
||||||
public class GameSimulation extends GameAdapter implements CommandSender {
|
|
||||||
|
/**
|
||||||
|
* Emulates the moves of a bot on a secondary board.
|
||||||
|
*/
|
||||||
|
public class GameSimulation extends GameAdapter implements AIActions {
|
||||||
|
|
||||||
private final CommandExecutor simulation;
|
private final CommandExecutor simulation;
|
||||||
private final Game gameSimulation;
|
private final Game gameSimulation;
|
||||||
|
|
||||||
public GameSimulation() {
|
public GameSimulation() {
|
||||||
this.gameSimulation = new PermissiveGame();
|
this.gameSimulation = new LightGame();
|
||||||
this.simulation = new CommandExecutor(gameSimulation, new EmptyGameDispatcher());
|
this.simulation = new CommandExecutor(gameSimulation, new EmptyGameDispatcher());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,6 +59,7 @@ public class GameSimulation extends GameAdapter implements CommandSender {
|
|||||||
sendUndo();
|
sendUndo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public CommandExecutor getCommandExecutor() {
|
public CommandExecutor getCommandExecutor() {
|
||||||
return simulation;
|
return simulation;
|
||||||
}
|
}
|
||||||
@@ -71,10 +76,6 @@ public class GameSimulation extends GameAdapter implements CommandSender {
|
|||||||
return this.gameSimulation.getPlayerTurn();
|
return this.gameSimulation.getPlayerTurn();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AIAction> getAllowedActions() {
|
|
||||||
return AIActions.getAllowedActions(this.simulation);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
this.simulation.close();
|
this.simulation.close();
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,10 @@ import chess.model.pieces.Pawn;
|
|||||||
import chess.model.pieces.Queen;
|
import chess.model.pieces.Queen;
|
||||||
import chess.model.pieces.Rook;
|
import chess.model.pieces.Rook;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Evaluate the cost of pieces for AI algorithm.
|
||||||
|
*/
|
||||||
|
|
||||||
public class PieceCost implements PieceVisitor<Float> {
|
public class PieceCost implements PieceVisitor<Float> {
|
||||||
|
|
||||||
private final Color player;
|
private final Color player;
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ import chess.model.pieces.Rook;
|
|||||||
|
|
||||||
public class PiecePosCost implements PieceVisitor<List<Float>> {
|
public class PiecePosCost implements PieceVisitor<List<Float>> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Evaluate the cost of position for AI algorithm.
|
||||||
|
*/
|
||||||
|
|
||||||
private final Color color;
|
private final Color color;
|
||||||
|
|
||||||
private static final List<Float> BISHOP = Arrays.asList(
|
private static final List<Float> BISHOP = Arrays.asList(
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import chess.controller.CommandExecutor;
|
|||||||
import chess.controller.CommandSender;
|
import chess.controller.CommandSender;
|
||||||
import chess.controller.commands.UndoCommand;
|
import chess.controller.commands.UndoCommand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class, manage the possible actions of a bot.
|
||||||
|
*/
|
||||||
public abstract class AIAction implements CommandSender {
|
public abstract class AIAction implements CommandSender {
|
||||||
|
|
||||||
private final CommandExecutor commandExecutor;
|
private final CommandExecutor commandExecutor;
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ package chess.ai.actions;
|
|||||||
import chess.controller.CommandExecutor;
|
import chess.controller.CommandExecutor;
|
||||||
import chess.controller.commands.CastlingCommand;
|
import chess.controller.commands.CastlingCommand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manage the transition between model and bots when it comes to Castling command.
|
||||||
|
*/
|
||||||
public class AIActionCastling extends AIAction{
|
public class AIActionCastling extends AIAction{
|
||||||
|
|
||||||
private final boolean bigCastling;
|
private final boolean bigCastling;
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import chess.controller.CommandExecutor;
|
|||||||
import chess.controller.commands.MoveCommand;
|
import chess.controller.commands.MoveCommand;
|
||||||
import chess.model.Move;
|
import chess.model.Move;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manage the transition between model and bots when it comes to Move command.
|
||||||
|
*/
|
||||||
public class AIActionMove extends AIAction{
|
public class AIActionMove extends AIAction{
|
||||||
|
|
||||||
private final Move move;
|
private final Move move;
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import chess.controller.commands.PromoteCommand;
|
|||||||
import chess.controller.commands.PromoteCommand.PromoteType;
|
import chess.controller.commands.PromoteCommand.PromoteType;
|
||||||
import chess.model.Move;
|
import chess.model.Move;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manage the transition between model and bots when it comes to Move and Promotion command.
|
||||||
|
*/
|
||||||
public class AIActionMoveAndPromote extends AIAction{
|
public class AIActionMoveAndPromote extends AIAction{
|
||||||
|
|
||||||
private final Move move;
|
private final Move move;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import chess.controller.Command;
|
import chess.controller.Command;
|
||||||
|
import chess.controller.CommandSender;
|
||||||
import chess.controller.Command.CommandResult;
|
import chess.controller.Command.CommandResult;
|
||||||
import chess.controller.CommandExecutor;
|
import chess.controller.CommandExecutor;
|
||||||
import chess.controller.commands.GetAllowedCastlingsCommand;
|
import chess.controller.commands.GetAllowedCastlingsCommand;
|
||||||
@@ -17,41 +18,45 @@ import chess.model.Move;
|
|||||||
import chess.model.Piece;
|
import chess.model.Piece;
|
||||||
import chess.model.pieces.Pawn;
|
import chess.model.pieces.Pawn;
|
||||||
|
|
||||||
public class AIActions {
|
|
||||||
|
|
||||||
public static List<AIAction> getAllowedActions(CommandExecutor commandExecutor) {
|
/**
|
||||||
List<Move> moves = getAllowedMoves(commandExecutor);
|
* Search and compiles the different actions possible to a bot.
|
||||||
CastlingResult castlingResult = getAllowedCastlings(commandExecutor);
|
*/
|
||||||
|
public interface AIActions extends CommandSender {
|
||||||
|
|
||||||
|
default List<AIAction> getAllowedActions() {
|
||||||
|
List<Move> moves = getPlayerMoves();
|
||||||
|
CastlingResult castlingResult = getAllowedCastlings();
|
||||||
|
|
||||||
List<AIAction> actions = new ArrayList<>(moves.size() + 10);
|
List<AIAction> actions = new ArrayList<>(moves.size() + 10);
|
||||||
|
|
||||||
for (Move move : moves) {
|
for (Move move : moves) {
|
||||||
Piece movingPiece = pieceAt(move.getStart(), commandExecutor);
|
Piece movingPiece = getPieceAt(move.getStart());
|
||||||
if (movingPiece instanceof Pawn) {
|
if (movingPiece instanceof Pawn) {
|
||||||
int enemyLineY = movingPiece.getColor() == Color.White ? 0 : 7;
|
int enemyLineY = movingPiece.getColor() == Color.White ? 0 : 7;
|
||||||
if (move.getFinish().getY() == enemyLineY) {
|
if (move.getFinish().getY() == enemyLineY) {
|
||||||
PromoteType[] promotes = PromoteType.values();
|
PromoteType[] promotes = PromoteType.values();
|
||||||
for (PromoteType promote : promotes) {
|
for (PromoteType promote : promotes) {
|
||||||
actions.add(new AIActionMoveAndPromote(commandExecutor, move, promote));
|
actions.add(new AIActionMoveAndPromote(getCommandExecutor(), move, promote));
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
actions.add(new AIActionMove(commandExecutor, move));
|
actions.add(new AIActionMove(getCommandExecutor(), move));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (castlingResult) {
|
switch (castlingResult) {
|
||||||
case Both:
|
case Both:
|
||||||
actions.add(new AIActionCastling(commandExecutor, true));
|
actions.add(new AIActionCastling(getCommandExecutor(), true));
|
||||||
actions.add(new AIActionCastling(commandExecutor, false));
|
actions.add(new AIActionCastling(getCommandExecutor(), false));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Small:
|
case Small:
|
||||||
actions.add(new AIActionCastling(commandExecutor, false));
|
actions.add(new AIActionCastling(getCommandExecutor(), false));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Big:
|
case Big:
|
||||||
actions.add(new AIActionCastling(commandExecutor, true));
|
actions.add(new AIActionCastling(getCommandExecutor(), true));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case None:
|
case None:
|
||||||
@@ -61,27 +66,4 @@ public class AIActions {
|
|||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CastlingResult getAllowedCastlings(CommandExecutor commandExecutor) {
|
|
||||||
GetAllowedCastlingsCommand cmd2 = new GetAllowedCastlingsCommand();
|
|
||||||
sendCommand(cmd2, commandExecutor);
|
|
||||||
return cmd2.getCastlingResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<Move> getAllowedMoves(CommandExecutor commandExecutor) {
|
|
||||||
GetPlayerMovesCommand cmd = new GetPlayerMovesCommand();
|
|
||||||
sendCommand(cmd, commandExecutor);
|
|
||||||
return cmd.getMoves();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static CommandResult sendCommand(Command command, CommandExecutor commandExecutor) {
|
|
||||||
CommandResult result = commandExecutor.executeCommand(command);
|
|
||||||
assert result != CommandResult.NotAllowed : "Command not allowed!";
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Piece pieceAt(Coordinate coordinate, CommandExecutor commandExecutor) {
|
|
||||||
GetPieceAtCommand command = new GetPieceAtCommand(coordinate);
|
|
||||||
commandExecutor.executeCommand(command);
|
|
||||||
return command.getPiece();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package chess.ai.minimax;
|
package chess.ai.ais;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -7,12 +7,17 @@ import java.util.concurrent.ExecutorService;
|
|||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
import chess.ai.AI;
|
import chess.ai.*;
|
||||||
import chess.ai.actions.AIAction;
|
import chess.ai.actions.*;
|
||||||
|
import chess.ai.alphabeta.*;
|
||||||
import chess.controller.CommandExecutor;
|
import chess.controller.CommandExecutor;
|
||||||
import chess.model.Color;
|
import chess.model.Color;
|
||||||
import common.Signal1;
|
import common.Signal1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extends AI. Bot based on the alpha-beta method of resolution.
|
||||||
|
*/
|
||||||
|
|
||||||
public class AlphaBetaAI extends AI {
|
public class AlphaBetaAI extends AI {
|
||||||
|
|
||||||
private final int searchDepth;
|
private final int searchDepth;
|
||||||
@@ -80,4 +85,9 @@ public class AlphaBetaAI extends AI {
|
|||||||
move.applyAction();
|
move.applyAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommandExecutor getCommandExecutor() {
|
||||||
|
return super.getCommandExecutor();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,17 @@
|
|||||||
package chess.ai;
|
package chess.ai.ais;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import chess.ai.*;
|
||||||
import chess.ai.actions.AIAction;
|
import chess.ai.actions.AIAction;
|
||||||
import chess.controller.CommandExecutor;
|
import chess.controller.CommandExecutor;
|
||||||
import chess.model.Color;
|
import chess.model.Color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bot, takes a random decision among his possible moves.
|
||||||
|
*/
|
||||||
|
|
||||||
public class DumbAI extends AI {
|
public class DumbAI extends AI {
|
||||||
|
|
||||||
private final Random random = new Random();
|
private final Random random = new Random();
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package chess.ai;
|
package chess.ai.ais;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -10,6 +10,16 @@ import chess.controller.CommandExecutor;
|
|||||||
import chess.model.Color;
|
import chess.model.Color;
|
||||||
import chess.model.Move;
|
import chess.model.Move;
|
||||||
import chess.model.Piece;
|
import chess.model.Piece;
|
||||||
|
import chess.ai.*;
|
||||||
|
import chess.ai.actions.*;
|
||||||
|
import chess.ai.actions.AIActions;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bot, takes the optimal piece when possible, or make a random move if no piece can be taken during the turn.
|
||||||
|
* @see PieceCost
|
||||||
|
* @see PiecePosCost
|
||||||
|
*/
|
||||||
|
|
||||||
public class HungryAI extends AI {
|
public class HungryAI extends AI {
|
||||||
|
|
||||||
@@ -23,7 +33,7 @@ public class HungryAI extends AI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getMoveCost(Move move) {
|
private int getMoveCost(Move move) {
|
||||||
Piece piece = pieceAt(move.getDeadPieceCoords());
|
Piece piece = getPieceAt(move.getDeadPieceCoords());
|
||||||
return -(int) pieceCost.getCost(piece);
|
return -(int) pieceCost.getCost(piece);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,5 +1,10 @@
|
|||||||
package chess.ai.minimax;
|
package chess.ai.alphabeta;
|
||||||
|
import chess.ai.ais.AlphaBetaAI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print the action of an alpha-beta bot on the console.
|
||||||
|
* @see AlphaBetaAI
|
||||||
|
*/
|
||||||
public class AlphaBetaConsolePrinter {
|
public class AlphaBetaConsolePrinter {
|
||||||
|
|
||||||
private final AlphaBetaAI ai;
|
private final AlphaBetaAI ai;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package chess.ai.minimax;
|
package chess.ai.alphabeta;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -6,6 +6,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import chess.ai.GameSimulation;
|
||||||
import chess.ai.PieceCost;
|
import chess.ai.PieceCost;
|
||||||
import chess.ai.PiecePosCost;
|
import chess.ai.PiecePosCost;
|
||||||
import chess.ai.actions.AIAction;
|
import chess.ai.actions.AIAction;
|
||||||
@@ -14,6 +15,11 @@ import chess.model.Color;
|
|||||||
import chess.model.Coordinate;
|
import chess.model.Coordinate;
|
||||||
import chess.model.Piece;
|
import chess.model.Piece;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manage the threads for an alpha-beta bot.
|
||||||
|
* @see AlphaBetaAI
|
||||||
|
*/
|
||||||
|
|
||||||
public class AlphaBetaThread extends Thread {
|
public class AlphaBetaThread extends Thread {
|
||||||
|
|
||||||
private final GameSimulation simulation;
|
private final GameSimulation simulation;
|
||||||
@@ -1,11 +1,16 @@
|
|||||||
package chess.ai.minimax;
|
package chess.ai.alphabeta;
|
||||||
|
|
||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
|
|
||||||
|
import chess.ai.GameSimulation;
|
||||||
import chess.ai.actions.AIAction;
|
import chess.ai.actions.AIAction;
|
||||||
import chess.controller.CommandExecutor;
|
import chess.controller.CommandExecutor;
|
||||||
import chess.model.Color;
|
import chess.model.Color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the threads for an alpha-beta bot.
|
||||||
|
* @see AlphaBetaAI
|
||||||
|
*/
|
||||||
public class AlphaBetaThreadCreator implements ThreadFactory{
|
public class AlphaBetaThreadCreator implements ThreadFactory{
|
||||||
|
|
||||||
private final Color color;
|
private final Color color;
|
||||||
@@ -3,18 +3,22 @@ package chess.controller;
|
|||||||
import chess.controller.event.GameListener;
|
import chess.controller.event.GameListener;
|
||||||
import chess.model.Game;
|
import chess.model.Game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class, manage the execution and results of commands.
|
||||||
|
*/
|
||||||
|
|
||||||
public abstract class Command {
|
public abstract class Command {
|
||||||
|
|
||||||
public enum CommandResult {
|
public enum CommandResult {
|
||||||
/**
|
/**
|
||||||
* The command was successfull. Should update display and switch player turn.
|
* The command was successful. Should update display and switch player turn.
|
||||||
*/
|
*/
|
||||||
Moved,
|
Moved,
|
||||||
/** The command was successfull. Should not update anything */
|
/** The command was successful. Should not update anything */
|
||||||
NotMoved,
|
NotMoved,
|
||||||
/** The command was successfull. Should only update display */
|
/** The command was successful. Should only update display */
|
||||||
ActionNeeded,
|
ActionNeeded,
|
||||||
/** The command was not successfull */
|
/** The command was not successful */
|
||||||
NotAllowed;
|
NotAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ import chess.controller.event.GameListener;
|
|||||||
import chess.model.Game;
|
import chess.model.Game;
|
||||||
import chess.model.Game.GameStatus;
|
import chess.model.Game.GameStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute commands.
|
||||||
|
*/
|
||||||
public class CommandExecutor {
|
public class CommandExecutor {
|
||||||
|
|
||||||
private Game game;
|
private Game game;
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ import chess.model.Coordinate;
|
|||||||
import chess.model.Move;
|
import chess.model.Move;
|
||||||
import chess.model.Piece;
|
import chess.model.Piece;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for sending commands to the game, make long string of commands easier.
|
||||||
|
*/
|
||||||
|
|
||||||
public interface CommandSender {
|
public interface CommandSender {
|
||||||
|
|
||||||
CommandExecutor getCommandExecutor();
|
CommandExecutor getCommandExecutor();
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ package chess.controller;
|
|||||||
import chess.controller.event.GameListener;
|
import chess.controller.event.GameListener;
|
||||||
import chess.model.Game;
|
import chess.model.Game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class, manage commands given by the player, which are the commands that can be undone.
|
||||||
|
*/
|
||||||
public abstract class PlayerCommand extends Command{
|
public abstract class PlayerCommand extends Command{
|
||||||
|
|
||||||
public CommandResult undo(Game game, GameListener outputSystem) {
|
public CommandResult undo(Game game, GameListener outputSystem) {
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import chess.model.Coordinate;
|
|||||||
import chess.model.Game;
|
import chess.model.Game;
|
||||||
import chess.model.Move;
|
import chess.model.Move;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command to execute a Castling or Big Castling.
|
||||||
|
*/
|
||||||
public class CastlingCommand extends PlayerCommand {
|
public class CastlingCommand extends PlayerCommand {
|
||||||
|
|
||||||
private Move kingMove;
|
private Move kingMove;
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import chess.controller.Command;
|
|||||||
import chess.controller.event.GameListener;
|
import chess.controller.event.GameListener;
|
||||||
import chess.model.Game;
|
import chess.model.Game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command to check the possible Castling.
|
||||||
|
*/
|
||||||
public class GetAllowedCastlingsCommand extends Command{
|
public class GetAllowedCastlingsCommand extends Command{
|
||||||
|
|
||||||
public enum CastlingResult {
|
public enum CastlingResult {
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ import chess.model.Coordinate;
|
|||||||
import chess.model.Game;
|
import chess.model.Game;
|
||||||
import chess.model.Piece;
|
import chess.model.Piece;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command to check the Castlings that are possible.
|
||||||
|
*/
|
||||||
public class GetAllowedMovesPieceCommand extends Command {
|
public class GetAllowedMovesPieceCommand extends Command {
|
||||||
|
|
||||||
private final Coordinate start;
|
private final Coordinate start;
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import chess.model.Coordinate;
|
|||||||
import chess.model.Game;
|
import chess.model.Game;
|
||||||
import chess.model.Piece;
|
import chess.model.Piece;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command to check the possible moves for a given piece.
|
||||||
|
*/
|
||||||
public class GetPieceAtCommand extends Command{
|
public class GetPieceAtCommand extends Command{
|
||||||
|
|
||||||
private final Coordinate pieceCoords;
|
private final Coordinate pieceCoords;
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ import chess.controller.event.GameListener;
|
|||||||
import chess.model.Game;
|
import chess.model.Game;
|
||||||
import chess.model.Move;
|
import chess.model.Move;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command to get the possible moves of a player. Castling and Promotion not included.
|
||||||
|
* @see CastlingCommand
|
||||||
|
* @see PromoteCommand
|
||||||
|
*/
|
||||||
public class GetPlayerMovesCommand extends Command {
|
public class GetPlayerMovesCommand extends Command {
|
||||||
|
|
||||||
private List<Move> moves;
|
private List<Move> moves;
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ import chess.model.Move;
|
|||||||
import chess.model.Piece;
|
import chess.model.Piece;
|
||||||
import chess.model.rules.PiecePathChecker;
|
import chess.model.rules.PiecePathChecker;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Command to move a piece. Castling not included.
|
||||||
|
*
|
||||||
|
* @see CastlingCommand
|
||||||
|
*/
|
||||||
public class MoveCommand extends PlayerCommand {
|
public class MoveCommand extends PlayerCommand {
|
||||||
|
|
||||||
private final Move move;
|
private final Move move;
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ import chess.model.pieces.Pawn;
|
|||||||
import chess.model.pieces.Queen;
|
import chess.model.pieces.Queen;
|
||||||
import chess.model.pieces.Rook;
|
import chess.model.pieces.Rook;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command to create a new game.
|
||||||
|
*/
|
||||||
public class NewGameCommand extends Command {
|
public class NewGameCommand extends Command {
|
||||||
public CommandResult execute(Game game, GameListener outputSystem) {
|
public CommandResult execute(Game game, GameListener outputSystem) {
|
||||||
final ChessBoard board = game.getBoard();
|
final ChessBoard board = game.getBoard();
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ import chess.model.pieces.Pawn;
|
|||||||
import chess.model.pieces.Queen;
|
import chess.model.pieces.Queen;
|
||||||
import chess.model.pieces.Rook;
|
import chess.model.pieces.Rook;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Command to promote a pawn.
|
||||||
|
*/
|
||||||
public class PromoteCommand extends PlayerCommand {
|
public class PromoteCommand extends PlayerCommand {
|
||||||
|
|
||||||
public enum PromoteType {
|
public enum PromoteType {
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import chess.controller.event.GameListener;
|
|||||||
import chess.model.Color;
|
import chess.model.Color;
|
||||||
import chess.model.Game;
|
import chess.model.Game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command to surrender a game.
|
||||||
|
*/
|
||||||
public class SurrenderCommand extends Command {
|
public class SurrenderCommand extends Command {
|
||||||
|
|
||||||
private final Color player;
|
private final Color player;
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import chess.controller.PlayerCommand;
|
|||||||
import chess.controller.event.GameListener;
|
import chess.controller.event.GameListener;
|
||||||
import chess.model.Game;
|
import chess.model.Game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command to undo the last action.
|
||||||
|
*/
|
||||||
public class UndoCommand extends Command{
|
public class UndoCommand extends Command{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ import chess.model.Color;
|
|||||||
import chess.model.Coordinate;
|
import chess.model.Coordinate;
|
||||||
import chess.model.Move;
|
import chess.model.Move;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a thread in which the notifications such as Move Not Allowed, Check, Checkmate, Promotion, Surrender, etc. will be sent to update the players.
|
||||||
|
*/
|
||||||
public class AsyncGameDispatcher extends GameDispatcher {
|
public class AsyncGameDispatcher extends GameDispatcher {
|
||||||
|
|
||||||
private final List<GameListener> listeners;
|
private final List<GameListener> listeners;
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import chess.model.Color;
|
|||||||
import chess.model.Coordinate;
|
import chess.model.Coordinate;
|
||||||
import chess.model.Move;
|
import chess.model.Move;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatcher for bots, does nothing.
|
||||||
|
*/
|
||||||
public class EmptyGameDispatcher extends GameDispatcher {
|
public class EmptyGameDispatcher extends GameDispatcher {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ import chess.model.Color;
|
|||||||
import chess.model.Coordinate;
|
import chess.model.Coordinate;
|
||||||
import chess.model.Move;
|
import chess.model.Move;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class, provides default implementation of GameListener methods.
|
||||||
|
* @see GameListener
|
||||||
|
*/
|
||||||
public abstract class GameAdapter implements GameListener {
|
public abstract class GameAdapter implements GameListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package chess.controller.event;
|
package chess.controller.event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class, provides a dispatcher for game events.
|
||||||
|
*/
|
||||||
public abstract class GameDispatcher extends GameAdapter {
|
public abstract class GameDispatcher extends GameAdapter {
|
||||||
|
|
||||||
public abstract void addListener(GameListener listener);
|
public abstract void addListener(GameListener listener);
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import chess.model.Color;
|
|||||||
import chess.model.Coordinate;
|
import chess.model.Coordinate;
|
||||||
import chess.model.Move;
|
import chess.model.Move;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for events to listen.
|
||||||
|
*/
|
||||||
public interface GameListener {
|
public interface GameListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,7 +8,13 @@ import chess.model.pieces.King;
|
|||||||
import chess.model.pieces.Pawn;
|
import chess.model.pieces.Pawn;
|
||||||
import chess.model.rules.PiecePathChecker;
|
import chess.model.rules.PiecePathChecker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chess board entity, composed of cells.
|
||||||
|
*/
|
||||||
public class ChessBoard {
|
public class ChessBoard {
|
||||||
|
/**
|
||||||
|
* Cell of the chess board.
|
||||||
|
*/
|
||||||
public static class Cell {
|
public static class Cell {
|
||||||
private Piece piece;
|
private Piece piece;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package chess.model;
|
package chess.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enumeration of colors for player - either black or white
|
||||||
|
*/
|
||||||
public enum Color {
|
public enum Color {
|
||||||
White,
|
White,
|
||||||
Black;
|
Black;
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package chess.model;
|
|||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Coordinate of a cell on the chess board.
|
||||||
|
*/
|
||||||
public class Coordinate {
|
public class Coordinate {
|
||||||
private final int x;
|
private final int x;
|
||||||
private final int y;
|
private final int y;
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
package chess.model;
|
package chess.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enumation of the different directions from a cell in a chessboard, and how to navigate the cells.
|
||||||
|
*/
|
||||||
|
|
||||||
public enum Direction {
|
public enum Direction {
|
||||||
|
|
||||||
Unset(65),
|
Unset(65),
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import java.util.Stack;
|
|||||||
import chess.controller.PlayerCommand;
|
import chess.controller.PlayerCommand;
|
||||||
import chess.controller.commands.MoveCommand;
|
import chess.controller.commands.MoveCommand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Game class that represents a chess game.
|
||||||
|
*/
|
||||||
|
|
||||||
public class Game {
|
public class Game {
|
||||||
private final ChessBoard board;
|
private final ChessBoard board;
|
||||||
private Color playerTurn;
|
private Color playerTurn;
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
package chess.model;
|
package chess.model;
|
||||||
|
|
||||||
public class PermissiveGame extends Game {
|
/**
|
||||||
|
* Game where the most ressource-consuming functions are empty.
|
||||||
|
* Mostly used by bots.
|
||||||
|
* @see GameSimulation
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class LightGame extends Game {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GameStatus checkGameStatus(Color color) {
|
public GameStatus checkGameStatus(Color color) {
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
package chess.model;
|
package chess.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chess move, composed of a starting position, a finishing position and the eventual enemy pieces taken during the move.
|
||||||
|
*/
|
||||||
|
|
||||||
public class Move {
|
public class Move {
|
||||||
private final Coordinate start;
|
private final Coordinate start;
|
||||||
private final Coordinate finish;
|
private final Coordinate finish;
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
package chess.model;
|
package chess.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Piece of a game. Posesses a color and the number of time it has been moved.
|
||||||
|
*/
|
||||||
|
|
||||||
public abstract class Piece {
|
public abstract class Piece {
|
||||||
|
|
||||||
private final Color color;
|
private final Color color;
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ import chess.model.pieces.Pawn;
|
|||||||
import chess.model.pieces.Queen;
|
import chess.model.pieces.Queen;
|
||||||
import chess.model.pieces.Rook;
|
import chess.model.pieces.Rook;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visitor interface for pieces.
|
||||||
|
*/
|
||||||
|
|
||||||
public interface PieceVisitor<T> {
|
public interface PieceVisitor<T> {
|
||||||
|
|
||||||
default T visit(Piece piece) {
|
default T visit(Piece piece) {
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import chess.model.Color;
|
|||||||
import chess.model.Piece;
|
import chess.model.Piece;
|
||||||
import chess.model.PieceVisitor;
|
import chess.model.PieceVisitor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bishop piece.
|
||||||
|
*/
|
||||||
public class Bishop extends Piece {
|
public class Bishop extends Piece {
|
||||||
|
|
||||||
public Bishop(Color color) {
|
public Bishop(Color color) {
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import chess.model.Color;
|
|||||||
import chess.model.Piece;
|
import chess.model.Piece;
|
||||||
import chess.model.PieceVisitor;
|
import chess.model.PieceVisitor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* King piece.
|
||||||
|
*/
|
||||||
public class King extends Piece {
|
public class King extends Piece {
|
||||||
|
|
||||||
public King(Color color) {
|
public King(Color color) {
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import chess.model.Color;
|
|||||||
import chess.model.Piece;
|
import chess.model.Piece;
|
||||||
import chess.model.PieceVisitor;
|
import chess.model.PieceVisitor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Knight piece.
|
||||||
|
*/
|
||||||
public class Knight extends Piece {
|
public class Knight extends Piece {
|
||||||
|
|
||||||
public Knight(Color color) {
|
public Knight(Color color) {
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import chess.model.Color;
|
|||||||
import chess.model.Piece;
|
import chess.model.Piece;
|
||||||
import chess.model.PieceVisitor;
|
import chess.model.PieceVisitor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pawn piece.
|
||||||
|
*/
|
||||||
public class Pawn extends Piece {
|
public class Pawn extends Piece {
|
||||||
|
|
||||||
public Pawn(Color color) {
|
public Pawn(Color color) {
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import chess.model.Color;
|
|||||||
import chess.model.Piece;
|
import chess.model.Piece;
|
||||||
import chess.model.PieceVisitor;
|
import chess.model.PieceVisitor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queen piece.
|
||||||
|
*/
|
||||||
public class Queen extends Piece {
|
public class Queen extends Piece {
|
||||||
|
|
||||||
public Queen(Color color) {
|
public Queen(Color color) {
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import chess.model.Color;
|
|||||||
import chess.model.Piece;
|
import chess.model.Piece;
|
||||||
import chess.model.PieceVisitor;
|
import chess.model.PieceVisitor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rook piece.
|
||||||
|
*/
|
||||||
public class Rook extends Piece {
|
public class Rook extends Piece {
|
||||||
|
|
||||||
public Rook(Color color) {
|
public Rook(Color color) {
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ import chess.model.pieces.Pawn;
|
|||||||
import chess.model.pieces.Queen;
|
import chess.model.pieces.Queen;
|
||||||
import chess.model.pieces.Rook;
|
import chess.model.pieces.Rook;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a move can be done.
|
||||||
|
*/
|
||||||
|
|
||||||
public class PermissiveRuleChecker implements PieceVisitor<Boolean> {
|
public class PermissiveRuleChecker implements PieceVisitor<Boolean> {
|
||||||
|
|
||||||
private final Move move;
|
private final Move move;
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ import chess.model.pieces.Pawn;
|
|||||||
import chess.model.pieces.Queen;
|
import chess.model.pieces.Queen;
|
||||||
import chess.model.pieces.Rook;
|
import chess.model.pieces.Rook;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if there are pieces in the path of a move.
|
||||||
|
*/
|
||||||
public class PiecePathChecker implements PieceVisitor<Boolean> {
|
public class PiecePathChecker implements PieceVisitor<Boolean> {
|
||||||
|
|
||||||
private final ChessBoard board;
|
private final ChessBoard board;
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ import chess.model.Move;
|
|||||||
import chess.model.Piece;
|
import chess.model.Piece;
|
||||||
import chess.model.pieces.Pawn;
|
import chess.model.pieces.Pawn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Export a game to PGN format.
|
||||||
|
*/
|
||||||
|
|
||||||
public class PgnExport {
|
public class PgnExport {
|
||||||
|
|
||||||
// public static void main(String[] args) {
|
// public static void main(String[] args) {
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ package chess.pgn;
|
|||||||
import chess.controller.CommandExecutor;
|
import chess.controller.CommandExecutor;
|
||||||
import common.AssetManager;
|
import common.AssetManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply moves from a pgn file at the start of a game.
|
||||||
|
*/
|
||||||
|
|
||||||
public class PgnFileSimulator extends PgnSimulator{
|
public class PgnFileSimulator extends PgnSimulator{
|
||||||
|
|
||||||
public PgnFileSimulator(CommandExecutor commandExecutor, String fileName) {
|
public PgnFileSimulator(CommandExecutor commandExecutor, String fileName) {
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ import chess.model.pieces.Pawn;
|
|||||||
import chess.model.pieces.Queen;
|
import chess.model.pieces.Queen;
|
||||||
import chess.model.pieces.Rook;
|
import chess.model.pieces.Rook;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import a game from PGN format.
|
||||||
|
*/
|
||||||
|
|
||||||
public class PgnImport {
|
public class PgnImport {
|
||||||
|
|
||||||
private static final Map<String, Class<? extends Piece>> pieceMap = Map.of(
|
private static final Map<String, Class<? extends Piece>> pieceMap = Map.of(
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import chess.controller.PlayerCommand;
|
|||||||
import chess.controller.event.GameAdapter;
|
import chess.controller.event.GameAdapter;
|
||||||
import common.Signal0;
|
import common.Signal0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply moves from a pgn string at the start of a game.
|
||||||
|
*/
|
||||||
|
|
||||||
public class PgnSimulator extends GameAdapter {
|
public class PgnSimulator extends GameAdapter {
|
||||||
|
|
||||||
private final CommandExecutor commandExecutor;
|
private final CommandExecutor commandExecutor;
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import chess.model.pieces.Pawn;
|
|||||||
import chess.model.pieces.Queen;
|
import chess.model.pieces.Queen;
|
||||||
import chess.model.pieces.Rook;
|
import chess.model.pieces.Rook;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visitor that returns the PGN name of a piece.
|
||||||
|
*/
|
||||||
|
|
||||||
public class PiecePgnName implements PieceVisitor<String> {
|
public class PiecePgnName implements PieceVisitor<String> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import org.joml.Vector2f;
|
|||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
import org.joml.Vector4f;
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 3D camera
|
||||||
|
*/
|
||||||
public class Camera {
|
public class Camera {
|
||||||
public static final float fov = 70.0f;
|
public static final float fov = 70.0f;
|
||||||
public static final float zNear = 0.01f;
|
public static final float zNear = 0.01f;
|
||||||
@@ -66,6 +69,9 @@ public class Camera {
|
|||||||
return new Matrix4f().lookAt(pos, center, up);
|
return new Matrix4f().lookAt(pos, center, up);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs a ray casting to find the selected cell by the cursor
|
||||||
|
*/
|
||||||
public Vector2f getCursorWorldFloorPos(Vector2f screenPos, int windowWidth, int windowHeight) {
|
public Vector2f getCursorWorldFloorPos(Vector2f screenPos, int windowWidth, int windowHeight) {
|
||||||
float relativeX = (screenPos.x / (float) windowWidth * 2.0f) - 1.0f;
|
float relativeX = (screenPos.x / (float) windowWidth * 2.0f) - 1.0f;
|
||||||
float relativeY = 1.0f - (screenPos.y / (float) windowHeight * 2.0f);
|
float relativeY = 1.0f - (screenPos.y / (float) windowHeight * 2.0f);
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import java.util.List;
|
|||||||
|
|
||||||
import chess.view.DDDrender.opengl.VertexArray;
|
import chess.view.DDDrender.opengl.VertexArray;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OpenGL model.
|
||||||
|
*/
|
||||||
public class DDDModel implements Closeable {
|
public class DDDModel implements Closeable {
|
||||||
private final List<VertexArray> vaos;
|
private final List<VertexArray> vaos;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,10 @@ import org.joml.Vector2f;
|
|||||||
|
|
||||||
import chess.model.Coordinate;
|
import chess.model.Coordinate;
|
||||||
|
|
||||||
class DDDPlacement {
|
/**
|
||||||
|
* Helper functions to convert from 2D to 3D coordinates systems.
|
||||||
|
*/
|
||||||
|
public class DDDPlacement {
|
||||||
public static Vector2f coordinatesToVector(Coordinate coo) {
|
public static Vector2f coordinatesToVector(Coordinate coo) {
|
||||||
return coordinatesToVector(coo.getX(), coo.getY());
|
return coordinatesToVector(coo.getX(), coo.getY());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,46 +73,38 @@ public class DDDView extends GameAdapter implements CommandSender {
|
|||||||
if (this.click == null) { // case: first click
|
if (this.click == null) { // case: first click
|
||||||
List<Coordinate> allowedMoves = getPieceAllowedMoves(coordinate);
|
List<Coordinate> allowedMoves = getPieceAllowedMoves(coordinate);
|
||||||
if (allowedMoves.isEmpty()) { // case: no movement possible for piece
|
if (allowedMoves.isEmpty()) { // case: no movement possible for piece
|
||||||
System.out.println("This piece cannot be moved at the moment.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setClick(coordinate);
|
setClick(coordinate);
|
||||||
previewMoves(coordinate);
|
previewMoves(coordinate);
|
||||||
// this.boardEntity.setCellColor(coordinate, BLUE);
|
|
||||||
System.out.println("First click on " + coordinate);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// case: second click
|
// case: second click
|
||||||
GetAllowedMovesPieceCommand movesCommand = new GetAllowedMovesPieceCommand(this.click);
|
GetAllowedMovesPieceCommand movesCommand = new GetAllowedMovesPieceCommand(this.click);
|
||||||
if (sendCommand(movesCommand) == CommandResult.NotAllowed) { // case: invalid piece to move
|
if (sendCommand(movesCommand) == CommandResult.NotAllowed) { // case: invalid piece to move
|
||||||
cancelPreview(this.click);
|
cancelPreview(this.click);
|
||||||
System.out.println("Nothing to do here.");
|
|
||||||
cancelClick();
|
cancelClick();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<Coordinate> allowedMoves = movesCommand.getDestinations();
|
List<Coordinate> allowedMoves = movesCommand.getDestinations();
|
||||||
if (allowedMoves.isEmpty()) { // case: no movement possible for piece
|
if (allowedMoves.isEmpty()) { // case: no movement possible for piece
|
||||||
cancelPreview(this.click);
|
cancelPreview(this.click);
|
||||||
System.out.println("This piece cannot be moved at the moment.");
|
|
||||||
cancelClick();
|
cancelClick();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (allowedMoves.contains(coordinate)) { // case: valid attempt to move
|
if (allowedMoves.contains(coordinate)) { // case: valid attempt to move
|
||||||
System.out.println("Move on " + coordinate);
|
|
||||||
cancelPreview(this.click);
|
cancelPreview(this.click);
|
||||||
sendMove(new Move(click, coordinate));
|
sendMove(new Move(click, coordinate));
|
||||||
cancelClick();
|
cancelClick();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(coordinate == this.click)) {
|
if (coordinate != this.click) { // cases: invalid move, selecting another piece
|
||||||
System.out.println("New click on " + coordinate); // cases: invalid move, selecting another piece
|
|
||||||
cancelPreview(this.click);
|
cancelPreview(this.click);
|
||||||
previewMoves(coordinate);
|
previewMoves(coordinate);
|
||||||
setClick(coordinate);
|
setClick(coordinate);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
System.out.println("Cancelling click."); // case: cancelling previous click
|
cancelClick(); // case: cancelling previous click
|
||||||
cancelClick();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void previewMoves(Coordinate coordinate) {
|
private void previewMoves(Coordinate coordinate) {
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ import chess.view.DDDrender.shader.BoardShader;
|
|||||||
import chess.view.DDDrender.shader.PieceShader;
|
import chess.view.DDDrender.shader.PieceShader;
|
||||||
import chess.view.DDDrender.shader.ShaderProgram;
|
import chess.view.DDDrender.shader.ShaderProgram;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic 3D renderer
|
||||||
|
*/
|
||||||
public class Renderer implements Closeable {
|
public class Renderer implements Closeable {
|
||||||
private BoardShader boardShader;
|
private BoardShader boardShader;
|
||||||
private PieceShader pieceShader;
|
private PieceShader pieceShader;
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ import static org.lwjgl.opengl.GL11.*;
|
|||||||
import static org.lwjgl.system.MemoryStack.*;
|
import static org.lwjgl.system.MemoryStack.*;
|
||||||
import static org.lwjgl.system.MemoryUtil.*;
|
import static org.lwjgl.system.MemoryUtil.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GLFW window.
|
||||||
|
*/
|
||||||
public class Window implements Closeable {
|
public class Window implements Closeable {
|
||||||
|
|
||||||
// The window handle
|
// The window handle
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ import chess.model.pieces.Queen;
|
|||||||
import chess.model.pieces.Rook;
|
import chess.model.pieces.Rook;
|
||||||
import chess.view.DDDrender.DDDModel;
|
import chess.view.DDDrender.DDDModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visitor that returns the 3d model of a piece.
|
||||||
|
*/
|
||||||
public class Piece3DModel implements PieceVisitor<String> {
|
public class Piece3DModel implements PieceVisitor<String> {
|
||||||
|
|
||||||
private static final String basePath = "3d/";
|
private static final String basePath = "3d/";
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ import chess.view.DDDrender.loader.BoardModelLoader;
|
|||||||
import chess.view.DDDrender.opengl.VertexArray;
|
import chess.view.DDDrender.opengl.VertexArray;
|
||||||
import chess.view.DDDrender.opengl.VertexBuffer;
|
import chess.view.DDDrender.opengl.VertexBuffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstraction of the 3D model of the board.
|
||||||
|
*/
|
||||||
public class BoardEntity extends Entity {
|
public class BoardEntity extends Entity {
|
||||||
|
|
||||||
private final VertexArray vao;
|
private final VertexArray vao;
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import org.joml.Matrix4f;
|
|||||||
|
|
||||||
import chess.view.DDDrender.Renderer;
|
import chess.view.DDDrender.Renderer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class for all entities in the 3D view.
|
||||||
|
*/
|
||||||
public abstract class Entity implements Closeable{
|
public abstract class Entity implements Closeable{
|
||||||
|
|
||||||
public abstract void render(Renderer renderer);
|
public abstract void render(Renderer renderer);
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import org.joml.Vector3f;
|
|||||||
import chess.view.DDDrender.DDDModel;
|
import chess.view.DDDrender.DDDModel;
|
||||||
import chess.view.DDDrender.Renderer;
|
import chess.view.DDDrender.Renderer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic type for 3D model that can be rendered.
|
||||||
|
*/
|
||||||
public class ModelEntity extends Entity {
|
public class ModelEntity extends Entity {
|
||||||
|
|
||||||
protected Vector3f position;
|
protected Vector3f position;
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ import org.joml.Vector3f;
|
|||||||
import chess.model.Piece;
|
import chess.model.Piece;
|
||||||
import chess.view.DDDrender.loader.Piece3DModel;
|
import chess.view.DDDrender.loader.Piece3DModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model entity of a piece. Loads the correct model of the resources files for the kind of piece.
|
||||||
|
*/
|
||||||
public class PieceEntity extends ModelEntity {
|
public class PieceEntity extends ModelEntity {
|
||||||
|
|
||||||
private static final Piece3DModel modelLoader = new Piece3DModel();
|
private static final Piece3DModel modelLoader = new Piece3DModel();
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ import chess.model.Coordinate;
|
|||||||
import chess.model.Move;
|
import chess.model.Move;
|
||||||
import chess.model.Piece;
|
import chess.model.Piece;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains all 3D entities.
|
||||||
|
*/
|
||||||
public class World implements Closeable{
|
public class World implements Closeable{
|
||||||
/** Renderable entity list */
|
/** Renderable entity list */
|
||||||
private final List<Entity> entites;
|
private final List<Entity> entites;
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ import java.net.URISyntaxException;
|
|||||||
|
|
||||||
import common.AssetManager;
|
import common.AssetManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manage audio files: download, save, and load them.
|
||||||
|
*/
|
||||||
|
|
||||||
public class AudioFiles {
|
public class AudioFiles {
|
||||||
|
|
||||||
private static final String baseURL = "https://images.chesscomfiles.com/chess-themes/sounds/_WAV_/default/";
|
private static final String baseURL = "https://images.chesscomfiles.com/chess-themes/sounds/_WAV_/default/";
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import javax.sound.sampled.AudioInputStream;
|
|||||||
import javax.sound.sampled.AudioSystem;
|
import javax.sound.sampled.AudioSystem;
|
||||||
import javax.sound.sampled.Clip;
|
import javax.sound.sampled.Clip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Audio player class to play sound files.
|
||||||
|
*/
|
||||||
public class AudioPlayer {
|
public class AudioPlayer {
|
||||||
public static void playSound(InputStream audio) {
|
public static void playSound(InputStream audio) {
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import chess.controller.event.GameAdapter;
|
|||||||
import chess.model.Coordinate;
|
import chess.model.Coordinate;
|
||||||
import chess.model.Move;
|
import chess.model.Move;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to handle audio events in the game.
|
||||||
|
*/
|
||||||
public class GameAudio extends GameAdapter {
|
public class GameAudio extends GameAdapter {
|
||||||
|
|
||||||
private final boolean functional;
|
private final boolean functional;
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package chess.view.consolerender;
|
package chess.view.consolerender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Colors class for console output, contains ANSI escape codes.
|
||||||
|
*/
|
||||||
public class Colors {
|
public class Colors {
|
||||||
// Reset
|
// Reset
|
||||||
public static final String RESET = "\u001B[0m"; // Text Reset
|
public static final String RESET = "\u001B[0m"; // Text Reset
|
||||||
@@ -15,24 +18,24 @@ public class Colors {
|
|||||||
public static final String CYAN = "\033[38;2;0;255;255m";
|
public static final String CYAN = "\033[38;2;0;255;255m";
|
||||||
|
|
||||||
// Background
|
// Background
|
||||||
public static final String BLACK_BACKGROUND = "\033[40m"; // BLACK
|
public static final String BLACK_BACKGROUND = "\033[40m";
|
||||||
public static final String LIGHT_GRAY_BACKGROUND = "\033[48;2;180;180;180m";
|
public static final String LIGHT_GRAY_BACKGROUND = "\033[48;2;180;180;180m";
|
||||||
public static final String DARK_GRAY_BACKGROUND = "\033[48;2;120;120;120m";
|
public static final String DARK_GRAY_BACKGROUND = "\033[48;2;120;120;120m";
|
||||||
public static final String RED_BACKGROUND = "\033[41m"; // RED
|
public static final String RED_BACKGROUND = "\033[41m";
|
||||||
public static final String GREEN_BACKGROUND = "\033[42m"; // GREEN
|
public static final String GREEN_BACKGROUND = "\033[42m";
|
||||||
public static final String YELLOW_BACKGROUND = "\033[43m"; // YELLOW
|
public static final String YELLOW_BACKGROUND = "\033[43m";
|
||||||
public static final String BLUE_BACKGROUND = "\033[44m"; // BLUE
|
public static final String BLUE_BACKGROUND = "\033[44m";
|
||||||
public static final String PURPLE_BACKGROUND = "\033[45m"; // PURPLE
|
public static final String PURPLE_BACKGROUND = "\033[45m";
|
||||||
public static final String CYAN_BACKGROUND = "\033[46m"; // CYAN
|
public static final String CYAN_BACKGROUND = "\033[46m";
|
||||||
public static final String WHITE_BACKGROUND = "\033[47m"; // WHITE
|
public static final String WHITE_BACKGROUND = "\033[47m";
|
||||||
|
|
||||||
// High Intensity backgrounds
|
// High Intensity backgrounds
|
||||||
public static final String BLACK_BACKGROUND_BRIGHT = "\033[0;100m";// BLACK
|
public static final String BLACK_BACKGROUND_BRIGHT = "\033[0;100m";
|
||||||
public static final String RED_BACKGROUND_BRIGHT = "\033[0;101m";// RED
|
public static final String RED_BACKGROUND_BRIGHT = "\033[0;101m";
|
||||||
public static final String GREEN_BACKGROUND_BRIGHT = "\033[0;102m";// GREEN
|
public static final String GREEN_BACKGROUND_BRIGHT = "\033[0;102m";
|
||||||
public static final String YELLOW_BACKGROUND_BRIGHT = "\033[0;103m";// YELLOW
|
public static final String YELLOW_BACKGROUND_BRIGHT = "\033[0;103m";
|
||||||
public static final String BLUE_BACKGROUND_BRIGHT = "\033[0;104m";// BLUE
|
public static final String BLUE_BACKGROUND_BRIGHT = "\033[0;104m";
|
||||||
public static final String PURPLE_BACKGROUND_BRIGHT = "\033[0;105m"; // PURPLE
|
public static final String PURPLE_BACKGROUND_BRIGHT = "\033[0;105m";
|
||||||
public static final String CYAN_BACKGROUND_BRIGHT = "\033[0;106m"; // CYAN
|
public static final String CYAN_BACKGROUND_BRIGHT = "\033[0;106m";
|
||||||
public static final String WHITE_BACKGROUND_BRIGHT = "\033[0;107m"; // WHITE
|
public static final String WHITE_BACKGROUND_BRIGHT = "\033[0;107m";
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,10 @@ import java.util.Scanner;
|
|||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Console renderer.
|
||||||
|
*/
|
||||||
|
|
||||||
public class Console extends GameAdapter implements CommandSender {
|
public class Console extends GameAdapter implements CommandSender {
|
||||||
private final Scanner scanner = new Scanner(System.in);
|
private final Scanner scanner = new Scanner(System.in);
|
||||||
private final CommandExecutor commandExecutor;
|
private final CommandExecutor commandExecutor;
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ import chess.model.Piece;
|
|||||||
import chess.model.PieceVisitor;
|
import chess.model.PieceVisitor;
|
||||||
import chess.model.pieces.*;
|
import chess.model.pieces.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manage appearance of pieces in the console.
|
||||||
|
*/
|
||||||
|
|
||||||
public class ConsolePieceName implements PieceVisitor<String> {
|
public class ConsolePieceName implements PieceVisitor<String> {
|
||||||
|
|
||||||
public String getString(Piece piece){
|
public String getString(Piece piece){
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ import chess.model.pieces.Queen;
|
|||||||
import chess.model.pieces.Rook;
|
import chess.model.pieces.Rook;
|
||||||
import common.AssetManager;
|
import common.AssetManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visitor that returns the png icon of a piece.
|
||||||
|
*/
|
||||||
|
|
||||||
public class PieceIcon implements PieceVisitor<String> {
|
public class PieceIcon implements PieceVisitor<String> {
|
||||||
|
|
||||||
private static final String basePath = "pieces2D/";
|
private static final String basePath = "pieces2D/";
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ import chess.controller.event.GameListener;
|
|||||||
import chess.model.Coordinate;
|
import chess.model.Coordinate;
|
||||||
import chess.model.Move;
|
import chess.model.Move;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Window for the 2D chess game.
|
||||||
|
*/
|
||||||
public class Window extends JFrame implements GameListener, CommandSender {
|
public class Window extends JFrame implements GameListener, CommandSender {
|
||||||
|
|
||||||
private final CommandExecutor commandExecutor;
|
private final CommandExecutor commandExecutor;
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manage loading of resources.
|
||||||
|
*/
|
||||||
public class AssetManager {
|
public class AssetManager {
|
||||||
|
|
||||||
private static final String gradleBase = "app/src/main/resources/";
|
private static final String gradleBase = "app/src/main/resources/";
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ package common;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal with no arguments.
|
||||||
|
*/
|
||||||
|
|
||||||
public class Signal0 {
|
public class Signal0 {
|
||||||
private final List<Runnable> handlers;
|
private final List<Runnable> handlers;
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal with one argument.
|
||||||
|
*/
|
||||||
|
|
||||||
public class Signal1<T> {
|
public class Signal1<T> {
|
||||||
private final List<Consumer<T>> handlers;
|
private final List<Consumer<T>> handlers;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ package chess;
|
|||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import chess.ai.DumbAI;
|
import chess.ai.ais.*;
|
||||||
import chess.controller.Command;
|
import chess.controller.Command;
|
||||||
import chess.controller.CommandExecutor;
|
import chess.controller.CommandExecutor;
|
||||||
import chess.controller.commands.NewGameCommand;
|
import chess.controller.commands.NewGameCommand;
|
||||||
@@ -14,6 +14,10 @@ import chess.controller.event.GameAdapter;
|
|||||||
import chess.model.Color;
|
import chess.model.Color;
|
||||||
import chess.model.Game;
|
import chess.model.Game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test class for the chess application.
|
||||||
|
* @see PgnTest for tests related to PGN import/export.
|
||||||
|
*/
|
||||||
class AppTest {
|
class AppTest {
|
||||||
private void functionalRollback(){
|
private void functionalRollback(){
|
||||||
Game game = new Game();
|
Game game = new Game();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import chess.ai.DumbAI;
|
import chess.ai.ais.*;
|
||||||
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;
|
||||||
@@ -18,6 +18,10 @@ import chess.pgn.PgnFileSimulator;
|
|||||||
import chess.pgn.PgnImport;
|
import chess.pgn.PgnImport;
|
||||||
import common.AssetManager;
|
import common.AssetManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Speicif test file for PGN import/export.
|
||||||
|
*/
|
||||||
|
|
||||||
public class PgnTest {
|
public class PgnTest {
|
||||||
|
|
||||||
private Game getRandomGame() {
|
private Game getRandomGame() {
|
||||||
|
|||||||
Reference in New Issue
Block a user