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