diff --git a/schach/src/main/java/de/hs_mannheim/informatik/chess/model/ChessEngine.java b/schach/src/main/java/de/hs_mannheim/informatik/chess/model/ChessEngine.java index 862575d..cf30994 100644 --- a/schach/src/main/java/de/hs_mannheim/informatik/chess/model/ChessEngine.java +++ b/schach/src/main/java/de/hs_mannheim/informatik/chess/model/ChessEngine.java @@ -30,12 +30,16 @@ public class ChessEngine { return false; } - public List getLegalDestinations(String from) { - List destinations = new ArrayList<>(); + public List getLegalDestinations(String from) { + List destinations = new ArrayList<>(); Square fromSq = Square.valueOf(from.toUpperCase()); for (Move move : board.legalMoves()) { if (move.getFrom().equals(fromSq)) { - destinations.add(move.getTo().toString()); // z.B. "E4" + int fromRow = 8 - fromSq.getRank().ordinal(); + int fromCol = fromSq.getFile().ordinal(); + int toRow = 8 - move.getTo().getRank().ordinal(); + int toCol = move.getTo().getFile().ordinal(); + destinations.add(new MoveDTO(fromRow, fromCol, toRow, toCol)); } } return destinations;