|
|
@ -88,10 +88,9 @@ public class TicTacToeGame extends JPanel { |
|
|
|
JOptionPane.showMessageDialog(getParent(),"Player: " + playerID + " Wins!"); |
|
|
|
scoreboard.addPoint(playerID); |
|
|
|
resetGame(); |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
turns++; |
|
|
|
if(turns > playFieldSize) { |
|
|
|
if(turns >= playFieldSize) { |
|
|
|
JOptionPane.showMessageDialog(getParent(),"Draw!"); |
|
|
|
scoreboard.addPoint(0); |
|
|
|
resetGame(); |
|
|
@ -103,6 +102,9 @@ public class TicTacToeGame extends JPanel { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public int checkPlayfield() { |
|
|
|
if ((field[0].playerID == playerID && field[1].playerID == playerID && field[2].playerID == playerID) |
|
|
|
|| (field[0].playerID == playerID && field[3].playerID == playerID && field[6].playerID == playerID) |
|
|
|