Question: /* Playing Tic Tac Game. Rules are : First player starts with X and to check winner if any columns or rows or diagonals match
/* Playing Tic Tac Game. Rules are : First player starts with X and to check winner if any columns or rows or diagonals match with X or O then that player is winner else Tie.*/
package tictactoe;
import java.util.Scanner; public class Tictactoe {
/** * @param args the command line arguments */ public static void main(String[] args) { //initializing board and update array char [][]board = new char [3][3]; char [][]update = new char[3][3]; board = printboard();// method to print the initial board and the array is returned to board insertXO(board); //Inserting X and ) method //updateboard(update); //checkwin(update); } public static char[][] printboard() // Printing initial board method { char [][]board = new char [3][3]; // initializing board. board [0][0] = '1'; // assinging 1 number of board to 1 board [0][1] = '2'; board [0][2] = '3'; board [1][0] = '4'; board [1][1] = '5'; board [1][2] = '6'; board [2][0] = '7'; board [2][1] = '8'; board [2][2] = '9'; System.out.println(board[0][0]+" | " + board[0][1]+ " | "+board[0][2]); // printing each row. System.out.println("----------"); System.out.println(board[1][0]+" | " + board[1][1]+ " | "+board[1][2]); System.out.println("----------"); System.out.println(board[2][0]+" | " + board[2][1]+ " | "+board[2][2]); return board; } public static void insertXO(char [][] board) // inserting X and O method. { int a,b,moves=0; // initializing variables. Scanner scnr = new Scanner (System.in);// Declaring Scanner while(moves<9) // repeating till moves <9 {>
CAN ANYONE DO IT FOR ME IN DIFFRENT WAY JUST
paraphrase IT means do it in difftent way
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
