Commit 396290a7 authored by Omid Sayfun's avatar Omid Sayfun

Possible fix for Queen move

parent 59b24e08
......@@ -23,8 +23,16 @@ public class Bishop extends Piece{
}
public boolean checkWay(ArrayList<Piece> pieces, char x, int y){
int xShift = (x - this.x) / Math.abs(x - this.x);;
int yShift = (y - this.y) / Math.abs(y - this.y);
int xShift = 0;
int yShift = 0;
if( this.x - x != 0 ){
xShift = (x - this.x) / Math.abs(x - this.x);
}
if( this.y - y != 0 ){
yShift = (y - this.y) / Math.abs(y - this.y);
}
int i = 1;
while( x != (char)(this.x + i * xShift) && y != this.y + i * yShift ){
if( checkTaken(pieces, (char)(this.x + i * xShift), this.y + i * yShift) ){
......
......@@ -33,10 +33,10 @@ public class Board{
this.whitePieces.add(newBishop);
}
// Queen
Queen whiteQueen = new Queen('E', 1, true, "WQ");
Queen whiteQueen = new Queen('D', 1, true,"WQ");
this.whitePieces.add(whiteQueen);
// King
King whiteKing = new King('D', 1, true, "WK");
King whiteKing = new King('E', 1, true, "WK");
this.whitePieces.add(whiteKing);
// Black Players
// Pawns
......@@ -60,10 +60,10 @@ public class Board{
this.blackPieces.add(newBishop);
}
// Queen
Queen blackQueen = new Queen('E', 8, false, "BQ");
Queen blackQueen = new Queen('D', 8, false, "BQ");
this.blackPieces.add(blackQueen);
// King
King blackKing = new King('D', 8, false, "BK");
King blackKing = new King('E', 8, false, "BK");
this.blackPieces.add(blackKing);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment