Skip to content

Commit 43117a2

Browse files
committed
Fix checkmate
1 parent 7c6c631 commit 43117a2

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/main/java/pl/nogacz/chess/application/BoardPoint.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,16 @@ public int calculateBoard() {
2525
if(entry.getValue().getColor().isWhite()) {
2626
if(pawnMoves.getPossibleCheck().size() > 0) {
2727
whitePoint += 100;
28-
blackPoint -= 100;
2928
} else if(pawnMoves.getPossibleKick().size() > 0) {
30-
whitePoint += 20;
29+
whitePoint += 5;
3130
}
3231

3332
whitePoint += calculatePawn(entry.getKey(), entry.getValue());
3433
} else {
3534
if(pawnMoves.getPossibleCheck().size() > 0) {
3635
blackPoint += 100;
37-
whitePoint -= 100;
3836
} else if(pawnMoves.getPossibleKick().size() > 0) {
39-
blackPoint += 20;
37+
blackPoint += 5;
4038
}
4139

4240
blackPoint += calculatePawn(entry.getKey(), entry.getValue());

src/main/java/pl/nogacz/chess/board/Board.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void readMouseEvent(MouseEvent event) {
117117
if(!gameLogic.isMovePossible()) {
118118
noMovePossibleInfo();
119119
} else if(isKingChecked && possiblePawnIfKingIsChecked.size() == 0) {
120-
if(gameLogic.isKingChecked(PawnColor.WHITE)) {
120+
if(gameLogic.isKingChecked(PawnColor.BLACK)) {
121121
statistics.addGameWin();
122122
endGame("You win! Congratulations :)");
123123
} else {

0 commit comments

Comments
 (0)