Skip to content

Commit

Permalink
Fix checkmate
Browse files Browse the repository at this point in the history
  • Loading branch information
sloenthran committed May 14, 2019
1 parent 7c6c631 commit 43117a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/main/java/pl/nogacz/chess/application/BoardPoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,16 @@ public int calculateBoard() {
if(entry.getValue().getColor().isWhite()) {
if(pawnMoves.getPossibleCheck().size() > 0) {
whitePoint += 100;
blackPoint -= 100;
} else if(pawnMoves.getPossibleKick().size() > 0) {
whitePoint += 20;
whitePoint += 5;
}

whitePoint += calculatePawn(entry.getKey(), entry.getValue());
} else {
if(pawnMoves.getPossibleCheck().size() > 0) {
blackPoint += 100;
whitePoint -= 100;
} else if(pawnMoves.getPossibleKick().size() > 0) {
blackPoint += 20;
blackPoint += 5;
}

blackPoint += calculatePawn(entry.getKey(), entry.getValue());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pl/nogacz/chess/board/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public void readMouseEvent(MouseEvent event) {
if(!gameLogic.isMovePossible()) {
noMovePossibleInfo();
} else if(isKingChecked && possiblePawnIfKingIsChecked.size() == 0) {
if(gameLogic.isKingChecked(PawnColor.WHITE)) {
if(gameLogic.isKingChecked(PawnColor.BLACK)) {
statistics.addGameWin();
endGame("You win! Congratulations :)");
} else {
Expand Down

0 comments on commit 43117a2

Please sign in to comment.