begin pgn
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package chess.model;
|
package chess.model;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
|
|
||||||
@@ -139,4 +140,8 @@ public class Game {
|
|||||||
undoTraitPiecesPos(Color.getEnemy(playerTurn));
|
undoTraitPiecesPos(Color.getEnemy(playerTurn));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<PlayerCommand> getMoves() {
|
||||||
|
return this.movesHistory;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
34
app/src/main/java/chess/pgn/PgnExport.java
Normal file
34
app/src/main/java/chess/pgn/PgnExport.java
Normal 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";
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user