victory checking
This commit is contained in:
parent
f854687c3e
commit
15fc3a6851
|
|
@ -449,7 +449,7 @@ public class Board {
|
|||
return;
|
||||
}
|
||||
|
||||
//get current piece coordinate
|
||||
//gets current piece coordinate
|
||||
int fromX = move.piece.getX();
|
||||
int fromY = move.piece.getY();
|
||||
int toX = move.toX;
|
||||
|
|
@ -479,7 +479,7 @@ public class Board {
|
|||
this.highlightedPositions.clear();
|
||||
}
|
||||
|
||||
//manually check for victory if needed
|
||||
//manually checks for victory if needed
|
||||
public boolean isCheckmate() {
|
||||
gameResult.checkForVictory(this);
|
||||
return gameResult.isGameOver();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package backend;
|
||||
|
||||
// Class to track the outcome of a chess game
|
||||
|
||||
public class GameResult {
|
||||
private boolean gameOver = false;
|
||||
private boolean whiteWon = false;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public class VictoryChecker {
|
|||
// Check if a player has won the chess game via checkmate
|
||||
|
||||
public static boolean checkVictory(Board board, boolean isWhitePlayer) {
|
||||
// The opponent is the one who would be checkmated
|
||||
// The opponent is the one who would be checkmated so opposite color
|
||||
boolean opponentColor = !isWhitePlayer;
|
||||
|
||||
// Debug info
|
||||
|
|
|
|||
Loading…
Reference in New Issue