started on b

This commit is contained in:
Johannes Schmelz 2024-06-13 18:15:48 +00:00
parent 49262c4954
commit 440eed0e9d
4 changed files with 6 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View File

@ -4,10 +4,14 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import uebung09.iterator.Array2dIterator; import uebung09.iterator.Array2dIterator;
public class Board extends Array2dIterator<Piece> { public class Board extends Array2dIterator<Piece>{
private final Piece[][] field = new Piece[8][8]; private final Piece[][] field = new Piece[8][8];
private final List<Piece> pieces = new ArrayList<>(); private final List<Piece> pieces = new ArrayList<>();
Board(){
}
void add(Piece piece) { void add(Piece piece) {
if (piece.getBoard() != this) if (piece.getBoard() != this)
throw new IllegalArgumentException("wrong board"); throw new IllegalArgumentException("wrong board");

View File

@ -12,6 +12,7 @@ public class ChessApp {
private static final String BLACK_QUEEN = "Q"; private static final String BLACK_QUEEN = "Q";
private static final String WHITE_KNIGHT = "n"; private static final String WHITE_KNIGHT = "n";
private static final String BLACK_KNIGHT = "N"; private static final String BLACK_KNIGHT = "N";
private static final String ITERATOR = "i";
private final Scanner scanner; private final Scanner scanner;
private final Board board; private final Board board;