Java. Starter code: import java.util.*; public class PoD { public static boolean validateBoard(String[][] gameBoard) { boolean validBoard; //PLEASE START YOUR WORK HERE //PLEASE END YOUR WORK HERE return (validBoard); } public static void main(String[] args) { //Instantiate new scanner to read from the console. Scanner in = new Scanner( System.in ); int gamePiece; String[][] ticTacToeBoard = new String[3][3]; for (int i=0; i<3; i++) { for (int j=0; j<3; j++) { //Read in board ticTacToeBoard[i][j] = in.next(); //Output board if (j<2) { System.out.print(ticTacToeBoard[i][j] + " "); } else { System.out.println(ticTacToeBoard[i][j]); } } } if (validateBoard(ticTacToeBoard)) { System.out.println("Valid board"); } else { System.out.println("Invalid board"); } } }
Java.
Starter code:
import java.util.*;
public class PoD {
public static boolean validateBoard(String[][] gameBoard) {
boolean validBoard;
//PLEASE START YOUR WORK HERE
//PLEASE END YOUR WORK HERE
return (validBoard);
}
public static void main(String[] args) {
//Instantiate new scanner to read from the console.
Scanner in = new Scanner( System.in );
int gamePiece;
String[][] ticTacToeBoard = new String[3][3];
for (int i=0; i<3; i++)
{
for (int j=0; j<3; j++)
{
//Read in board
ticTacToeBoard[i][j] = in.next();
//Output board
if (j<2)
{
System.out.print(ticTacToeBoard[i][j] + " ");
}
else
{
System.out.println(ticTacToeBoard[i][j]);
}
}
}
if (validateBoard(ticTacToeBoard)) {
System.out.println("Valid board");
}
else {
System.out.println("Invalid board");
}
}
}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 5 images