populate
This commit is contained in:
parent
340aeb094a
commit
f5e5cba0b1
|
|
@ -34,7 +34,56 @@ public class Board {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void populateBoard() {
|
public void populateBoard() {
|
||||||
|
for (int y=0;y<8;y++) {
|
||||||
|
for(int x=0;x<8;x++) {
|
||||||
|
if(x==0||x==7) {
|
||||||
|
if (y==0) {
|
||||||
|
pieces.add(new Piece(x,y,"black", PieceType.Rook));
|
||||||
|
}
|
||||||
|
if (y==7) {
|
||||||
|
pieces.add(new Piece(x,y,"white", PieceType.Rook));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(x==1||x==6) {
|
||||||
|
if (y==0) {
|
||||||
|
pieces.add(new Piece(x,y,"black", PieceType.Knight));
|
||||||
|
}
|
||||||
|
if (y==7) {
|
||||||
|
pieces.add(new Piece(x,y,"white", PieceType.Knight));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(x==2||x==5) {
|
||||||
|
if (y==0) {
|
||||||
|
pieces.add(new Piece(x,y,"black", PieceType.Bishop));
|
||||||
|
}
|
||||||
|
if (y==7) {
|
||||||
|
pieces.add(new Piece(x,y,"white", PieceType.Bishop));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(x==3) {
|
||||||
|
if (y==0) {
|
||||||
|
pieces.add(new Piece(x,y,"black", PieceType.Queen));
|
||||||
|
}
|
||||||
|
if (y==7) {
|
||||||
|
pieces.add(new Piece(x,y,"white", PieceType.Queen));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(x==4) {
|
||||||
|
if (y==0) {
|
||||||
|
pieces.add(new Piece(x,y,"black", PieceType.King));
|
||||||
|
}
|
||||||
|
if (y==7) {
|
||||||
|
pieces.add(new Piece(x,y,"white", PieceType.King));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(y==1) {
|
||||||
|
pieces.add(new Piece(x,y,"black", PieceType.Pawn));
|
||||||
|
}
|
||||||
|
if(y==6) {
|
||||||
|
pieces.add(new Piece(x,y,"white", PieceType.Pawn));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cleanBoard() {
|
public void cleanBoard() {
|
||||||
|
|
@ -48,7 +97,6 @@ public class Board {
|
||||||
|
|
||||||
public ArrayList<Piece> getPieces() {
|
public ArrayList<Piece> getPieces() {
|
||||||
ArrayList<Piece> pieces = new ArrayList<>();
|
ArrayList<Piece> pieces = new ArrayList<>();
|
||||||
//TODO
|
|
||||||
|
|
||||||
return pieces;
|
return pieces;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue