i want to move a bishop diagonally from one point to another
i want to move it from (row=8,column=3) to (row=7,column=2)
the move is valid
but i want to secure it against any collision with another piece. so i am running an loop from the initial position to the next.
problem is that there is some failure.. i dont know why.
the loops are inside a method i am calling from the main method (main class).
here they are:
for(int i=rowStart;i>rowEnd;i--){ // it should reduce 8 to 7.
for(int j=columnStart;j>columnEnd;j--){// it should reduce 3 to 2
while(pieces[i][j]==null){
a++;/ here it should count, the number of times a square is equal to null.
}
if(a<size){ // if few squares equal to size (rowStart-rowEnd, in this case 1), then it should give me valid false. and return it!
valid1=false;
}
else{
valid1=true;
}
}
}
am i correct or do i have a mistake?