Question
Please help me! Program Specification: Write a Java program that playes a simple game of Tic-Tac-Toe: This is a two player (Xs and Os) board
Please help me!
Program Specification:
Write a Java program that playes a simple game of Tic-Tac-Toe:
This is a two player (Xs and Os) board game.
The game board is a 3 X 3 grid, where each location can hold either an X an O or space (empty) Note: we will linearize the grid and refer to its locations as 1 - 9, for conveyance.
The players take turns placing their mark into one of the (empty) locations in the grid.
The game is won when a player has their mark in all three locations of any row, column, or diagonal.
The game can also reach a stalemate: neither player has won (by above criteria) however there are no more empty locations in the grid. Requirement(s):
You must use an appropriate user-validation loop for all user input.
Hint(s):
Use nine char variables (initialized to ) to represent the 9 grid locations.
Keep track of the total number of moves, for an easy stalemate detection.
Your location choice user-validation loop must also not accept any location that is not currently empty.
At times things will feel very tedious - doing the same thing nine times ...
Sample run(s): Welcone to Tic-Tac-Toe goea first Please enter location to nove [1-910 Please enter location to nove [1-9]:-1 Please enter location to nove [1-9] Please enter location to nove [1 9] :1 Please enter location to nove [1 -9]2 Please enter Location to nove 1 9] :3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started