|
@ -66,12 +66,18 @@ public class Logic { |
|
|
int size = getBoardSize() - 1; |
|
|
int size = getBoardSize() - 1; |
|
|
while(getField(size, column) != 0) { |
|
|
while(getField(size, column) != 0) { |
|
|
size--; |
|
|
size--; |
|
|
|
|
|
if(size < 0) { |
|
|
|
|
|
return -1; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
return size; |
|
|
return size; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public int playChip(int column) { |
|
|
public int playChip(int column) { |
|
|
setField(getCurrentPlayer(), getFreePlace(column), column); |
|
|
setField(getCurrentPlayer(), getFreePlace(column), column); |
|
|
|
|
|
if(getFreePlace(column) == -1) { |
|
|
|
|
|
buttons[column].setEnabled(false); |
|
|
|
|
|
} |
|
|
updateGui(); |
|
|
updateGui(); |
|
|
if(testForWin()) { |
|
|
if(testForWin()) { |
|
|
gameover(); |
|
|
gameover(); |
|
@ -238,5 +244,9 @@ public class Logic { |
|
|
setPlayer2Score(calcScore()); |
|
|
setPlayer2Score(calcScore()); |
|
|
} |
|
|
} |
|
|
clearField(); |
|
|
clearField(); |
|
|
|
|
|
for(int i = 0; i < getBoardSize(); i++) { |
|
|
|
|
|
buttons[i].setEnabled(true); |
|
|
|
|
|
} |
|
|
|
|
|
updateGui(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |