|
|
@ -47,16 +47,19 @@ public class GameLogic { |
|
|
|
|
|
|
|
// check columns |
|
|
|
for (int i = 0; i < this.board.length; i++) { |
|
|
|
if(countFields == this.board.length) return finished = true; |
|
|
|
countFields = 0; |
|
|
|
for (int j = 0; j < this.board[0].length; j++) { |
|
|
|
if(board[i][j] == player) countFields++; |
|
|
|
if(board[j][i] == player) countFields++; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if(countFields == this.board.length) finished = true; |
|
|
|
countFields = 0; |
|
|
|
|
|
|
|
// check rows |
|
|
|
for (int i = 0; i < this.board[0].length; i++) { |
|
|
|
for (int j = 0; j < this.board.length; j++) { |
|
|
|
if(board[j][i] == player) countFields++; |
|
|
|
if(board[i][j] == player) countFields++; |
|
|
|
} |
|
|
|
} |
|
|
|
if(countFields == this.board.length) finished = true; |
|
|
|