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:
@ -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();
|
||||
|
Reference in New Issue
Block a user