Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (ticGrid[0][0] == 1 && ticGrid[0][1] == 1 && ticGrid[0][2] == 1) {
- System.out.println("Player 1 wins");
- xWin++;
- } else if (ticGrid[1][0] == 1 && ticGrid[1][1] == 1 && ticGrid[1][2] == 1) {
- System.out.println("Player 1 wins");
- xWin++;
- } else if (ticGrid[2][0] == 1 && ticGrid[2][1] == 1 && ticGrid[2][2] == 1) {
- System.out.println("Player 1 wins");
- xWin++;
- } else if (ticGrid[0][0] == 1 && ticGrid[1][0] == 1 && ticGrid[2][0] == 1) {
- System.out.println("Player 1 wins");
- xWin++;
- } else if (ticGrid[0][1] == 1 && ticGrid[1][1] == 1 && ticGrid[2][1] == 1) {
- System.out.println("Player 1 wins");
- xWin++;
- } else if (ticGrid[0][2] == 1 && ticGrid[1][2] == 1 && ticGrid[2][2] == 1) {
- System.out.println("Player 1 wins");
- xWin++;
- } else if (ticGrid[0][0] == 1 && ticGrid[1][1] == 1 && ticGrid[2][2] == 1) {
- System.out.println("Player 1 wins");
- xWin++;
- } else if (ticGrid[0][2] == 1 && ticGrid[1][1] == 1 && ticGrid[1][2] == 1) {
- System.out.println("Player 1 wins");
- xWin++;
- //O win condition
- } else if (ticGrid[0][0] == 2 && ticGrid[0][1] == 2 && ticGrid[0][2] == 2) {
- System.out.println("Player 2 wins");
- oWin++;
- } else if (ticGrid[1][0] == 2 && ticGrid[1][1] == 2 && ticGrid[1][2] == 2) {
- System.out.println("Player 2 wins");
- oWin++;
- } else if (ticGrid[2][0] == 2 && ticGrid[2][1] == 2 && ticGrid[2][2] == 2) {
- System.out.println("Player 2 wins");
- oWin++;
- } else if (ticGrid[0][0] == 2 && ticGrid[1][0] == 2 && ticGrid[2][0] == 2) {
- System.out.println("Player 2 wins");
- oWin++;
- } else if (ticGrid[0][1] == 2 && ticGrid[1][1] == 2 && ticGrid[2][1] == 2) {
- System.out.println("Player 2 wins");
- oWin++;
- } else if (ticGrid[0][2] == 2 && ticGrid[1][2] == 2 && ticGrid[2][2] == 2) {
- System.out.println("Player 2 wins");
- oWin++;
- } else if (ticGrid[0][0] == 2 && ticGrid[1][1] == 2 && ticGrid[2][2] == 2) {
- System.out.println("Player 2 wins");
- oWin++;
- } else if (ticGrid[0][2] == 2 && ticGrid[1][1] == 2 && ticGrid[0][2] == 2) {
- System.out.println("Player 2 wins");
- oWin++;
- } else {
- System.out.println();
- player++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement