feat: pgn parser

This commit is contained in:
2025-05-03 20:46:20 +02:00
parent b2a6b23681
commit b18b53f195
21 changed files with 384 additions and 219 deletions

View File

@@ -0,0 +1,28 @@
package chess.pgn;
import java.util.List;
import chess.controller.CommandExecutor;
import chess.controller.PlayerCommand;
import chess.controller.commands.NewGameCommand;
import chess.controller.event.GameAdaptator;
import chess.model.Game;
public class PgnSimulator extends GameAdaptator {
private final CommandExecutor commandExecutor;
private final String pgn;
public PgnSimulator(CommandExecutor commandExecutor, String pgn) {
this.commandExecutor = commandExecutor;
this.pgn = pgn;
}
@Override
public void onGameStart() {
List<PlayerCommand> cmds = PgnImport.importGame(this.pgn);
this.commandExecutor.executeCommands(cmds);
}
}