//Java program
import java.util.*;
public class PoD {
public static void main(String args[]) {
Scanner in = new
Scanner(System.in);
int gamepeice;
String [][] ticTacBoard = new
String[3][3];
for(int i=0;i<3;i++) {
for(int
j=0;j<3;j++) {
ticTacBoard[i][j] = in.next();
if(i<2)
{
System.out.print(ticTacBoard[i][j]+" ");
}
else {
System.out.print(ticTacBoard[i][j]+" ");
}
}
}
if(validateBoard(ticTacBoard))
{
System.out.println("valid board");
}
else System.out.println("Invalid
board");
System.out.println("END OF
OUTPUT");
in.close();
}
private static boolean validateBoard(String[][]
ticTacBoard) {
int countx=0;
int counto = 0;
for(int i=0;i<3;i++) {
for(int
j=0;j<3;j++) {
if(ticTacBoard[i][j]=="X"||ticTacBoard[i][j]=="x")countx++;
if(ticTacBoard[i][j]=="O"||ticTacBoard[i][j]=="o")counto++;
}
}
return (countx==counto ||(countx ==
counto+1));
}
}
You are going to write a method (to be called validateBoard) that is going to validate...
JAVA TIC TAC TOE - please help me correct my code Write a program that will allow two players to play a game of TIC TAC TOE. When the program starts, it will display a tic tac toe board as below | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 The program will assign X to Player 1, and O to Player The program will ask Player 1, to...
In a game of Tic Tac Toe, two players take turns making an available cell in a 3 x 3 grid with their respective tokens (either X or O). When one player has placed three tokens in a horizontal, vertical, or diagonal row on the grid, the game is over and that player has won. A stalemate occurs when all the cells on the grid have been filled with tokens and neither player has achieved a win. Write a program...
In a game of Tic Tac Toe, two players take turns making an available cell in a 3 x 3 grid with their respective tokens (either X or O). When one player has placed three tokens in a horizontal, vertical, or diagonal row on the grid, the game is over and that player has won. A stalemate occurs when all the cells on the grid have been filled with tokens and neither player has achieved a win. Write a program...
C programming language Purpose The purpose of this assignment is to help you to practice working with functions, arrays, and design simple algorithms Learning Outcomes ● Develop skills with multidimensional arrays ● Learn how to traverse multidimensional arrays ● Passing arrays to functions ● Develop algorithm design skills (e.g. recursion) Problem Overview Problem Overview Tic-Tac-Toe (also known as noughts and crosses or Xs and Os) is a paper-and-pencil game for two players, X and O, who take turns marking the...
In traditional Tic Tac Toe game, two players take turns to mark grids with noughts and crosses on the 3 x 3 game board. The player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row in the game board wins the game. Super Tic Tac Toe game also has a 3 x 3 game board with super grid. Each super grid itself is a traditional Tic Tac Toe board. Winning a game of Tic...
I have already finished most of this assignment. I just need some help with the canMove and main methods; pseudocode is also acceptable. Also, the programming language is java. Crickets and Grasshoppers is a simple two player game played on a strip of n spaces. Each space can be empty or have a piece. The first player plays as the cricket pieces and the other plays as grasshoppers and the turns alternate. We’ll represent crickets as C and grasshoppers as...
Hi, I am a student in college who is trying to make a tic tac toe game on Java. Basically, we have to make our own game, even ones that already exist, on Java. We also have to implement an interface, that I have no idea exactly. The professor also stated we need at least 2 different data structures and algorithms for the code. The professor said we could use code online, we'd just have to make some of our...
In a game of Tic Tac Toe, two players take turns making an available cell in a 3 x 3 grid with their respective tokens (either X or O). When one player has placed three tokens in a horizontal, vertical, or diagonal row on the grid, the game is over and that player has won. A stalemate occurs when all the cells on the grid have been filled with tokens and neither player has achieved a win. Write a program...
Lab 01 Tic Tac Toe Objective: Write a class called TicTacToeBoard which is used by a driver to play a game of Tic Tac Toe. Download the driver which contains the game loop and the user input. DO NOT MODIFY THE DRIVER! The class TicTacToeBoard needs to have the following: Instance Variables A 2D 3x3 matrix of Strings called spaces. This will be used to select the where the player put their marker Class Variables (these need to be public...
Please modify the following code to NOT have "TicTacToe extends Board" (I don't want any extending). Please ensure the resulting code completes EACH part of the following prompt: "Your task is to create a game of Tic-Tac-Toe using a 2-Dimensional String array as the game board. Start by creating a Board class that holds the array. The constructor should use a traditional for-loop to fill the array with "blank" Strings (eg. "-"). You may want to include other instance data......