|
|
@ -17,7 +17,10 @@ public class Logic { |
|
|
|
int currentPlayer; |
|
|
|
|
|
|
|
public int playChip(int[][] playfield, int column, int player) { |
|
|
|
|
|
|
|
//add board update |
|
|
|
|
|
|
|
//updateGui(playfield); |
|
|
|
testForWin(playfield, player); |
|
|
|
currentPlayer = (player % 2) + 1; |
|
|
|
return 0; |
|
|
@ -54,6 +57,20 @@ public class Logic { |
|
|
|
return contentPanel; |
|
|
|
} |
|
|
|
|
|
|
|
public void updateGui(int[][] playfield) { |
|
|
|
for(int i = 0; i < playfield.length; i++) { |
|
|
|
for(int j = 0; j < playfield[i].length; j++) { |
|
|
|
if(playfield[i][j] == 0) { |
|
|
|
gamefield[j + 6 * i].setBackground(Color.white); |
|
|
|
} else if(playfield[i][j] == 1) { |
|
|
|
gamefield[j + 6 * i].setBackground(Color.red); |
|
|
|
} else { |
|
|
|
gamefield[j + 6 * i].setBackground(Color.yellow); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
class ButtonListener implements ActionListener { |
|
|
|
|
|
|
|
@Override |
|
|
|