Addind a test for promotion. Everything seems to work fine.
This commit is contained in:
@ -55,7 +55,9 @@ public class TestMoves {
|
|||||||
Piece movePiece = new Piece(whatMove.toCharArray()[0],playerColor);
|
Piece movePiece = new Piece(whatMove.toCharArray()[0],playerColor);
|
||||||
if (whatMove.length()==6) {
|
if (whatMove.length()==6) {
|
||||||
theMove = new MoveTest(whatMove.substring(2,6),movePiece);
|
theMove = new MoveTest(whatMove.substring(2,6),movePiece);
|
||||||
} else {
|
} else if(whatMove.length()==7){ //promotion
|
||||||
|
theMove = new MoveTest(whatMove.substring(2,7),movePiece);
|
||||||
|
} else if (whatMove.length()==8){ //capture sans promotion
|
||||||
Piece capturePiece;
|
Piece capturePiece;
|
||||||
if (playerColor==Piece.WHITE) {
|
if (playerColor==Piece.WHITE) {
|
||||||
capturePiece = new Piece(whatMove.toCharArray()[7],Piece.BLACK);
|
capturePiece = new Piece(whatMove.toCharArray()[7],Piece.BLACK);
|
||||||
@ -64,6 +66,15 @@ public class TestMoves {
|
|||||||
capturePiece = new Piece(whatMove.toCharArray()[7],Piece.WHITE);
|
capturePiece = new Piece(whatMove.toCharArray()[7],Piece.WHITE);
|
||||||
theMove = new MoveTest(whatMove.substring(2,6),movePiece,capturePiece);
|
theMove = new MoveTest(whatMove.substring(2,6),movePiece,capturePiece);
|
||||||
}
|
}
|
||||||
|
} else { //capture avec promotion
|
||||||
|
Piece capturePiece;
|
||||||
|
if (playerColor==Piece.WHITE) {
|
||||||
|
capturePiece = new Piece(whatMove.toCharArray()[8],Piece.BLACK);
|
||||||
|
theMove = new MoveTest(whatMove.substring(2,7),movePiece,capturePiece);
|
||||||
|
} else {
|
||||||
|
capturePiece = new Piece(whatMove.toCharArray()[8],Piece.WHITE);
|
||||||
|
theMove = new MoveTest(whatMove.substring(2,7),movePiece,capturePiece);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
theMove.display();
|
theMove.display();
|
||||||
bitboard.doMove(theMove);
|
bitboard.doMove(theMove);
|
||||||
|
Reference in New Issue
Block a user