Added a List to get all Moves in ChessEngine

Quicksave
Justin 2025-06-20 02:17:17 +02:00
parent 47591a7264
commit 2dab6128b4
1 changed files with 3 additions and 1 deletions

View File

@ -9,7 +9,8 @@ import com.github.bhlangonijr.chesslib.move.Move;
public class ChessEngine {
private Board board;
private List<Move> moves = new ArrayList<>();
public ChessEngine() {
board = new Board();
}
@ -20,6 +21,7 @@ public class ChessEngine {
Move libMove = new Move(Square.valueOf(from), Square.valueOf(to));
if (board.legalMoves().contains(libMove)) {
board.doMove(libMove);
moves.add(libMove); // <-- hier merken!
return true;
}
return false;