Currently In the Process of making a Chess Game, While making the Code for 'CheckMate', I got a problem where the if statement did not execute, even though all conditions were met.
if (boardCopy[x][y] != null)
{
System.out.print(boardCopy[x][y].getColour() + " == " + turn.charAt(0)+" && "+ boardCopy[x][y].getName().substring(0,2)+" == ki && Checkmate == "+ CheckMate[x][y]);
if (boardCopy[x][y].getColour() == turn.charAt(0) && boardCopy[x][y].getName().substring(0,2) == "ki" && CheckMate[x][y])
{
System.out.println(turn + "'s King is in Check");
check = true;
}
System.out.println(" | Check = "+check);
}
The Output from the Code (the important part, since it was in a for loop it was repeated with slight variations multiple times
W == W && ki == ki && Checkmate == true | Check = false
All conditions are met yet the code isn't executing. Thoughts? (all variables types are correct, no misspelling, W refers to the colour of the piece, ki is the first two letters of the name of the piece ('king'), checkmate is a boolean array containing where a location is being 'attacked' by an enemy piece.)