begin pgn

This commit is contained in:
2025-04-14 11:21:30 +02:00
parent 3bea2eeb2d
commit d8c927083a
2 changed files with 39 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
package chess.model;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Stack;
@@ -139,4 +140,8 @@ public class Game {
undoTraitPiecesPos(Color.getEnemy(playerTurn));
}
public List<PlayerCommand> getMoves() {
return this.movesHistory;
}
}

View File

@@ -0,0 +1,34 @@
package chess.pgn;
import chess.controller.CommandExecutor;
import chess.controller.commands.NewGameCommand;
import chess.controller.event.GameAdaptator;
import chess.model.ChessBoard;
import chess.model.Game;
import chess.simulator.FoolCheckMate;
import chess.view.consolerender.Console;
public class PgnExport {
public static void main(String[] args) {
final Game game = new Game(new ChessBoard());
final CommandExecutor commandExecutor = new CommandExecutor(game);
FoolCheckMate checkMate = new FoolCheckMate(commandExecutor);
commandExecutor.addListener(checkMate);
commandExecutor.addListener(new GameAdaptator() {
@Override
public void onGameEnd() {
System.out.println(exportGame(game));
commandExecutor.close();
}
});
commandExecutor.executeCommand(new NewGameCommand());
}
public static String exportGame(Game game) {
return "coucou";
}
}