|
|
@ -23,11 +23,11 @@ public class StartTicTacToeGame implements ActionListener{ |
|
|
|
player1fieldButton7Pressed, player1fieldButton8Pressed, |
|
|
|
player1fieldButton9Pressed = false; |
|
|
|
|
|
|
|
boolean player2buttonPressed, player2button2Pressed, |
|
|
|
player2button3Pressed, player2button4Pressed, |
|
|
|
player2button5Pressed, player2button6Pressed, |
|
|
|
player2button7Pressed, player2button8Pressed, |
|
|
|
player2button9Pressed = false; |
|
|
|
boolean player2fieldButtonPressed, player2fieldButton2Pressed, |
|
|
|
player2fieldButton3Pressed, player2fieldButton4Pressed, |
|
|
|
player2fieldButton5Pressed, player2fieldButton6Pressed, |
|
|
|
player2fieldButton7Pressed, player2fieldButton8Pressed, |
|
|
|
player2fieldButton9Pressed = false; |
|
|
|
|
|
|
|
boolean player1Turn = true; |
|
|
|
boolean player2Turn = false; |
|
|
@ -149,7 +149,7 @@ public class StartTicTacToeGame implements ActionListener{ |
|
|
|
fieldButton.setFont(new Font("arial", Font.PLAIN, 30)); |
|
|
|
fieldButton.setEnabled(false); |
|
|
|
player1Turn(); |
|
|
|
player2buttonPressed = true; |
|
|
|
player2fieldButtonPressed = true; |
|
|
|
check(); |
|
|
|
} |
|
|
|
} |
|
|
@ -169,7 +169,7 @@ public class StartTicTacToeGame implements ActionListener{ |
|
|
|
fieldButton2.setFont(new Font("arial", Font.PLAIN, 30)); |
|
|
|
fieldButton2.setEnabled(false); |
|
|
|
player1Turn(); |
|
|
|
player2button2Pressed = true; |
|
|
|
player2fieldButton2Pressed = true; |
|
|
|
check(); |
|
|
|
} |
|
|
|
} |
|
|
@ -189,7 +189,7 @@ public class StartTicTacToeGame implements ActionListener{ |
|
|
|
fieldButton3.setFont(new Font("arial", Font.PLAIN, 30)); |
|
|
|
player1Turn(); |
|
|
|
fieldButton3.setEnabled(false); |
|
|
|
player2button3Pressed = true; |
|
|
|
player2fieldButton3Pressed = true; |
|
|
|
check(); |
|
|
|
} |
|
|
|
} |
|
|
@ -209,7 +209,7 @@ public class StartTicTacToeGame implements ActionListener{ |
|
|
|
fieldButton4.setFont(new Font("arial", Font.PLAIN, 30)); |
|
|
|
player1Turn(); |
|
|
|
fieldButton4.setEnabled(false); |
|
|
|
player2button4Pressed = true; |
|
|
|
player2fieldButton4Pressed = true; |
|
|
|
check(); |
|
|
|
} |
|
|
|
} |
|
|
@ -229,7 +229,7 @@ public class StartTicTacToeGame implements ActionListener{ |
|
|
|
fieldButton5.setFont(new Font("arial", Font.PLAIN, 30)); |
|
|
|
player1Turn(); |
|
|
|
fieldButton5.setEnabled(false); |
|
|
|
player2button5Pressed = true; |
|
|
|
player2fieldButton5Pressed = true; |
|
|
|
check(); |
|
|
|
} |
|
|
|
} |
|
|
@ -249,7 +249,7 @@ public class StartTicTacToeGame implements ActionListener{ |
|
|
|
fieldButton6.setFont(new Font("arial", Font.PLAIN, 30)); |
|
|
|
player1Turn(); |
|
|
|
fieldButton6.setEnabled(false); |
|
|
|
player2button6Pressed = true; |
|
|
|
player2fieldButton6Pressed = true; |
|
|
|
check(); |
|
|
|
} |
|
|
|
} |
|
|
@ -269,7 +269,7 @@ public class StartTicTacToeGame implements ActionListener{ |
|
|
|
fieldButton7.setFont(new Font("arial", Font.PLAIN, 30)); |
|
|
|
player1Turn(); |
|
|
|
fieldButton7.setEnabled(false); |
|
|
|
player2button7Pressed = true; |
|
|
|
player2fieldButton7Pressed = true; |
|
|
|
check(); |
|
|
|
} |
|
|
|
} |
|
|
@ -289,7 +289,7 @@ public class StartTicTacToeGame implements ActionListener{ |
|
|
|
fieldButton8.setFont(new Font("arial", Font.PLAIN, 30)); |
|
|
|
player1Turn(); |
|
|
|
fieldButton8.setEnabled(false); |
|
|
|
player2button8Pressed = true; |
|
|
|
player2fieldButton8Pressed = true; |
|
|
|
check(); |
|
|
|
} |
|
|
|
} |
|
|
@ -309,7 +309,7 @@ public class StartTicTacToeGame implements ActionListener{ |
|
|
|
fieldButton9.setFont(new Font("arial", Font.PLAIN, 30)); |
|
|
|
fieldButton9.setEnabled(false); |
|
|
|
player1Turn(); |
|
|
|
player2button9Pressed = true; |
|
|
|
player2fieldButton9Pressed = true; |
|
|
|
check(); |
|
|
|
} |
|
|
|
} |
|
|
@ -378,31 +378,31 @@ public class StartTicTacToeGame implements ActionListener{ |
|
|
|
player1Won(); |
|
|
|
} |
|
|
|
|
|
|
|
if(player2buttonPressed && player2button2Pressed && player2button3Pressed) { |
|
|
|
if(player2fieldButtonPressed && player2fieldButton2Pressed && player2fieldButton3Pressed) { |
|
|
|
player2Won(); |
|
|
|
} |
|
|
|
else if(player2button4Pressed && player2button5Pressed && player2button6Pressed) { |
|
|
|
else if(player2fieldButton4Pressed && player2fieldButton5Pressed && player2fieldButton6Pressed) { |
|
|
|
player2Won(); |
|
|
|
} |
|
|
|
else if(player2button7Pressed && player2button8Pressed && player2button9Pressed) { |
|
|
|
else if(player2fieldButton7Pressed && player2fieldButton8Pressed && player2fieldButton9Pressed) { |
|
|
|
player2Won(); |
|
|
|
} |
|
|
|
else if(player2buttonPressed && player2button5Pressed && player2button6Pressed) { |
|
|
|
else if(player2fieldButtonPressed && player2fieldButton5Pressed && player2fieldButton6Pressed) { |
|
|
|
player2Won(); |
|
|
|
} |
|
|
|
else if(player2buttonPressed && player2button4Pressed && player2button7Pressed) { |
|
|
|
else if(player2fieldButtonPressed && player2fieldButton4Pressed && player2fieldButton7Pressed) { |
|
|
|
player2Won(); |
|
|
|
} |
|
|
|
else if(player2button2Pressed && player2button5Pressed && player2button8Pressed) { |
|
|
|
else if(player2fieldButton2Pressed && player2fieldButton5Pressed && player2fieldButton8Pressed) { |
|
|
|
player2Won(); |
|
|
|
} |
|
|
|
else if(player2button3Pressed && player2button6Pressed && player2button9Pressed) { |
|
|
|
else if(player2fieldButton3Pressed && player2fieldButton6Pressed && player2fieldButton9Pressed) { |
|
|
|
player2Won(); |
|
|
|
} |
|
|
|
else if(player2buttonPressed && player2button5Pressed && player2button9Pressed) { |
|
|
|
else if(player2fieldButtonPressed && player2fieldButton5Pressed && player2fieldButton9Pressed) { |
|
|
|
player2Won(); |
|
|
|
} |
|
|
|
else if(player2button3Pressed && player2button5Pressed && player2button7Pressed) { |
|
|
|
else if(player2fieldButton3Pressed && player2fieldButton5Pressed && player2fieldButton7Pressed) { |
|
|
|
player2Won(); |
|
|
|
} |
|
|
|
} |