Browse Source

4gewinnt: refactored actionListener

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

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

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

Loading…
Cancel
Save