|
@ -13,6 +13,7 @@ public class GameLogic implements ActionListener { |
|
|
private static final char PLAYER_2 = 'o'; |
|
|
private static final char PLAYER_2 = 'o'; |
|
|
private char[][] board; |
|
|
private char[][] board; |
|
|
private final char[] occupiedFields = { PLAYER_1, PLAYER_2 }; |
|
|
private final char[] occupiedFields = { PLAYER_1, PLAYER_2 }; |
|
|
|
|
|
private char currentPlayer = PLAYER_1; |
|
|
|
|
|
|
|
|
private JButton[][] fields; |
|
|
private JButton[][] fields; |
|
|
private JPanel contentPanel; |
|
|
private JPanel contentPanel; |
|
@ -105,8 +106,13 @@ public class GameLogic implements ActionListener { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public char getCurrentPlayer() { |
|
|
public char getCurrentPlayer() { |
|
|
return 'x'; |
|
|
|
|
|
|
|
|
return this.currentPlayer; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void switchPlayer() { |
|
|
|
|
|
this.currentPlayer = this.currentPlayer == PLAYER_1 ? PLAYER_2 : PLAYER_1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public JPanel generateGUI() { |
|
|
public JPanel generateGUI() { |
|
|
this.fields = new JButton[this.board.length][this.board.length]; |
|
|
this.fields = new JButton[this.board.length][this.board.length]; |
|
@ -137,5 +143,5 @@ public class GameLogic implements ActionListener { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |