prommote works
This commit is contained in:
parent
3e0f23aafd
commit
2200b06d7b
|
|
@ -1,11 +1,11 @@
|
||||||
BR, ,BB,BQ,BK,BB,BN,BR,
|
BR,BN,BB,BQ,BK,BB,BN,BR,
|
||||||
BP,BP,BP, , , , ,BP,
|
BP,BP, ,BP, , , ,BP,
|
||||||
BN, , , , , , , ,
|
, , , ,BP, , , ,
|
||||||
, , ,BP,BP,BP,BP, ,
|
, ,BP, , ,BP,BP, ,
|
||||||
, , , , ,WP,WP, ,
|
,WP,WB, ,WP, , , ,
|
||||||
, , , , ,WN, ,WB,
|
, , , , , , ,WN,
|
||||||
WP,WP,WP,WP,WP, , ,WP,
|
WP, ,WP,WP, ,WP,WP,WP,
|
||||||
WR,WN,WB,WQ,WK, , ,WR,
|
WR,WN,WB,WQ,WK, , ,WR,
|
||||||
9
|
8
|
||||||
1630
|
1230
|
||||||
00000010
|
00000010
|
||||||
|
|
|
||||||
|
|
@ -340,10 +340,19 @@ public class Board {
|
||||||
|
|
||||||
this.turnNumber +=1;
|
this.turnNumber +=1;
|
||||||
}
|
}
|
||||||
int j = 0;
|
// Promotion
|
||||||
|
int j1 = 0; // the lines at the top and the bottom of the board
|
||||||
|
int j2 = 7;
|
||||||
for (int i=0; i<8;i++) {
|
for (int i=0; i<8;i++) {
|
||||||
if (this.positionOccupied(x, y)==true) {
|
if (this.positionOccupied(i, j1)==true) { // verify if there is a piece on the top line
|
||||||
|
if(pieces.get(this.whatPiece(i, j1)).getType() == PieceType.Pawn) { // if there is a piece is it a pawn
|
||||||
|
pieces.get(this.whatPiece(i, j1)).setType(PieceType.Queen); // if yes transform it into a queen
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.positionOccupied(i, j2)==true) {
|
||||||
|
if(pieces.get(this.whatPiece(i, j2)).getType() == PieceType.Pawn) {
|
||||||
|
pieces.get(this.whatPiece(i, j2)).setType(PieceType.Queen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// we now reset our parameters
|
// we now reset our parameters
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue