|
|
@ -88,19 +88,21 @@ public class TicTacToeGame extends JPanel { |
|
|
|
JOptionPane.showMessageDialog(getParent(),"Player: " + playerID + " Wins!"); |
|
|
|
scoreboard.addPoint(playerID); |
|
|
|
resetGame(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
turns++; |
|
|
|
if(turns >= playFieldSize) { |
|
|
|
JOptionPane.showMessageDialog(getParent(),"Draw!"); |
|
|
|
scoreboard.addPoint(0); |
|
|
|
resetGame(); |
|
|
|
} |
|
|
|
|
|
|
|
turns++; |
|
|
|
if(turns > playFieldSize) { |
|
|
|
JOptionPane.showMessageDialog(getParent(),"Draw!"); |
|
|
|
scoreboard.addPoint(0); |
|
|
|
resetGame(); |
|
|
|
playerID++; |
|
|
|
if(playerID >= maxPlayers) { |
|
|
|
playerID = 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
playerID++; |
|
|
|
if(playerID >= maxPlayers) { |
|
|
|
playerID = 1; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public int checkPlayfield() { |
|
|
|