Browse Source

4gewinnt: refactored actionListener

4gewinnt
Steffen Helmke 3 years ago
committed by Lorenz Hohmann
parent
commit
743162ef15
  1. 27
      src/main/java/de/tims/viergewinnt/ai/Logic.java

27
src/main/java/de/tims/viergewinnt/ai/Logic.java

@ -13,7 +13,12 @@ import javax.swing.JPanel;
public class Logic {
int[][] board;
int currentPlayer;
public int playChip(int[][] playfield, int column, int player) {
testForWin(playfield, player);
return 0;
}
@ -50,23 +55,11 @@ public class Logic {
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == buttons[0]) {
}
if(e.getSource() == buttons[1]) {
}
if(e.getSource() == buttons[2]) {
}
if(e.getSource() == buttons[3]) {
}
if(e.getSource() == buttons[4]) {
}
if(e.getSource() == buttons[5]) {
for(int i = 0; i < buttons.length; i++) {
if(e.getSource() == buttons[i]) {
playChip(board, i, currentPlayer);
break;
}
}
}

Loading…
Cancel
Save