Addind a test for promotion. Everything seems to work fine.

This commit is contained in:
2006-01-08 17:15:42 +00:00
parent 8a2690fb91
commit 3d5028f898

View File

@ -55,7 +55,9 @@ public class TestMoves {
Piece movePiece = new Piece(whatMove.toCharArray()[0],playerColor);
if (whatMove.length()==6) {
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;
if (playerColor==Piece.WHITE) {
capturePiece = new Piece(whatMove.toCharArray()[7],Piece.BLACK);
@ -64,6 +66,15 @@ public class TestMoves {
capturePiece = new Piece(whatMove.toCharArray()[7],Piece.WHITE);
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();
bitboard.doMove(theMove);