Skip to content

Commit

Permalink
game lock after win
Browse files Browse the repository at this point in the history
  • Loading branch information
235857 authored and 235857 committed May 25, 2022
1 parent fefa582 commit 5e7a536
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/main/java/tictactoe/arena/components/BigBoard.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
public class BigBoard extends GridPane {

private static final int[][] coords = new int[9][2];
private final Logic bigLogic;
private static final Logic bigLogic = new Logic();

public BigBoard() {
bigLogic = new Logic();
getStyleClass().add("BigBoard");
generateSmallBoards();
}

public static int checkForWin() {
return bigLogic.checkForWin();
}

private void generateSmallBoards() {
int ids = 1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@ public SmallBoardButton(int x, int y, SmallBoard board) {

// CO SIE DZIEJE PO KLIKNIECIU
setOnAction(e -> {
if (gameBoard.checkBoardWin() != 0)

// Check for bitBoard win
if (BigBoard.checkForWin() != 0) {
return;
}

// Check for smallBoard win
if (gameBoard.checkBoardWin() != 0) {
return;
}
if (!this.getText().isEmpty())
return;
setText(String.valueOf(gameBoard.getGameLogic().getMark()));
Expand Down

0 comments on commit 5e7a536

Please sign in to comment.