java project Description In this stage, we’re going to analyze the game state to determine if either of the players has
Posted: Sat Nov 27, 2021 2:35 pm
java project
Description
In this stage, we’re going to analyze the game state to determine if either of the players has already won the game or it is still ongoing, if the game is a draw, or if the user has entered an impossible game state (two winners, or with one player having made too many moves).
Objectives
In this stage, your program should:
1.Take a string entered by the user and print the game grid as in the previous stage.
2.Analyze the game state and print the result. Possible states:
•Game not finished when neither side has three in a row but the grid still has empty cells.
•Draw when no side has a three in a row and the grid has no empty cells.
•X wins when the grid has three X’s in a row.
•O wins when the grid has three O’s in a row.
•Impossible when the grid has three X’s in a row as well as three O’s in a row, or there are a lot more X's than O's or vice versa (the difference should be 1 or 0; if the difference is 2 or more, then the game state is impossible).
In this stage, we will assume that either X or O can start the game.
You can choose whether to use a space or underscore _ to print empty cells.
Examples
The examples below show outputs and analysis results for different game states. Your program should work in the same way.
Notice that after Enter cells: comes the user input.
Example 1: Enter cells: Xxxoo_o_ 100 x wins Example 2: Enter cells: XOXOXOXXO хох | loxol | | ххо X wins
Example 3: Enter cells: xoopxoxxo Toxo 1 xx0 | Ordins Example 4: XOXOOXXXO Enter cells: IXOX оох ххо | Draw
Example 5: Enter cells: XO_00X_X 100x Game not finished Example 6: Enter cells: xo_XO_XOX Txo. XOX Impossible
Example 7: Enter cells: _0_XXX Impossible Example 8: Enter cells: „0000_XX | 001 Impossible
Description
In this stage, we’re going to analyze the game state to determine if either of the players has already won the game or it is still ongoing, if the game is a draw, or if the user has entered an impossible game state (two winners, or with one player having made too many moves).
Objectives
In this stage, your program should:
1.Take a string entered by the user and print the game grid as in the previous stage.
2.Analyze the game state and print the result. Possible states:
•Game not finished when neither side has three in a row but the grid still has empty cells.
•Draw when no side has a three in a row and the grid has no empty cells.
•X wins when the grid has three X’s in a row.
•O wins when the grid has three O’s in a row.
•Impossible when the grid has three X’s in a row as well as three O’s in a row, or there are a lot more X's than O's or vice versa (the difference should be 1 or 0; if the difference is 2 or more, then the game state is impossible).
In this stage, we will assume that either X or O can start the game.
You can choose whether to use a space or underscore _ to print empty cells.
Examples
The examples below show outputs and analysis results for different game states. Your program should work in the same way.
Notice that after Enter cells: comes the user input.
Example 1: Enter cells: Xxxoo_o_ 100 x wins Example 2: Enter cells: XOXOXOXXO хох | loxol | | ххо X wins
Example 3: Enter cells: xoopxoxxo Toxo 1 xx0 | Ordins Example 4: XOXOOXXXO Enter cells: IXOX оох ххо | Draw
Example 5: Enter cells: XO_00X_X 100x Game not finished Example 6: Enter cells: xo_XO_XOX Txo. XOX Impossible
Example 7: Enter cells: _0_XXX Impossible Example 8: Enter cells: „0000_XX | 001 Impossible