This commit is contained in:
@@ -25,27 +25,6 @@ import chess.model.pieces.Pawn;
|
||||
|
||||
public class PgnExport {
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// final Game game = new Game();
|
||||
// final CommandExecutor commandExecutor = new CommandExecutor(game);
|
||||
|
||||
// DumbAI ai1 = new DumbAI(commandExecutor, Color.White);
|
||||
// commandExecutor.addListener(ai1);
|
||||
|
||||
// DumbAI ai2 = new DumbAI(commandExecutor, Color.Black);
|
||||
// commandExecutor.addListener(ai2);
|
||||
|
||||
// commandExecutor.addListener(new GameAdapter() {
|
||||
// @Override
|
||||
// public void onGameEnd() {
|
||||
// System.out.println(exportGame(game));
|
||||
// commandExecutor.close();
|
||||
// }
|
||||
// });
|
||||
|
||||
// commandExecutor.executeCommand(new NewGameCommand());
|
||||
// }
|
||||
|
||||
private static final PiecePgnName piecePgnName = new PiecePgnName();
|
||||
|
||||
private static Piece pieceAt(CommandExecutor commandExecutor, Coordinate coordinate) {
|
||||
@@ -76,6 +55,12 @@ public class PgnExport {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve PGN ambiguity in the case of two pieces of the same type able to move on the same square.
|
||||
* @param cmdExec the command executor attached to the game
|
||||
* @param pieceMove move of the piece
|
||||
* @return the character that solves the eventual ambiguity, empty if no ambiguity to start with
|
||||
*/
|
||||
private static String resolveAmbiguity(CommandExecutor cmdExec, Move pieceMove) {
|
||||
Piece movingPiece = pieceAt(cmdExec, pieceMove.getStart());
|
||||
|
||||
@@ -109,6 +94,12 @@ public class PgnExport {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* From a move, get the capture-part of the associated PGN string.
|
||||
* @param move the move
|
||||
* @param movingPiece the piece that is moving
|
||||
* @return the capture string of the PGN move
|
||||
*/
|
||||
private static String capture(MoveCommand move, Piece movingPiece) {
|
||||
String result = "";
|
||||
if (move.getDeadPiece() != null) {
|
||||
|
||||
Reference in New Issue
Block a user