Testing and debugging of the rules :

by typing "hint a3" it is possible to know all the possible moves for the piece on a3.
(Pawn and Queen not implemented yet)
This commit is contained in:
2006-01-11 18:32:01 +00:00
parent 3b77c214df
commit 0ffdf58af4
6 changed files with 1454 additions and 1330 deletions

View File

@ -2,6 +2,7 @@ package suicideChess;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import suicideChess.Move.NotAValidMoveException;
import suicideChess.Square.NotAValidSquare;
@ -46,6 +47,7 @@ public class SuicideChess {
/*int playerColor = Piece.WHITE;
System.out.println("White: ");*/
while (true) {
try {
String whatMove= moveInput.readLine();
@ -55,6 +57,23 @@ public class SuicideChess {
break;
}
if (whatMove.startsWith("move")) {
Move move = new Move(new Square(0), new Square(1), new Piece(2), new Piece(3), new Piece(Piece.NONE));
move.display();
continue;
}
if (whatMove.startsWith("hint")) {
Rules rules = new Rules();
ArrayList<Move> allLegalMoves =
rules.legalMovesFromSquare(new Square(whatMove.substring(5,7)),bitboard);
for(int i = 0; i<allLegalMoves.size(); i++) {
allLegalMoves.get(i).display();
}
continue;
}
Move theMove = new Move(whatMove, bitboard);
theMove.display();