From 3d5028f8983aa01ffefe05da7f9be4c88ca54c49 Mon Sep 17 00:00:00 2001 From: djib Date: Sun, 8 Jan 2006 17:15:42 +0000 Subject: [PATCH] Addind a test for promotion. Everything seems to work fine. --- src/tests/TestMoves.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/tests/TestMoves.java b/src/tests/TestMoves.java index ef2fd4e..c2f2998 100644 --- a/src/tests/TestMoves.java +++ b/src/tests/TestMoves.java @@ -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);