Home / Expert Answers / Computer Science / please-help-complete-this-program-in-java-in-this-project-you-will-have-to-develop-a-game-of-tic-pa818

(Solved): Please help complete this program in Java. In this project you will have to develop a game of Tic ...



Please help complete this program in Java.

In this project you will have to develop a game of Tic-Tac-Toe. For this project you will have to make use of Loops and ifConditions for this project to be followed:
1. Declare a 2-D array to hold the nine positions in the tic-tac-toe board.
2. InHere is the code for the check box pattern for the game:

In this project you will have to develop a game of Tic-Tac-Toe. For this project you will have to make use of "Loops" and "if-else" statements. The game should be played between two players, and the rounds must alternate between player 1 and player 2. Make use of boolean for switch between player 1 and player 2. This game should produce either of 3 results. Either player 1 won the game or player 2 won the game or the game is a draw. The sample runs below will illustrate the different scenarios. Conditions for this project to be followed: 1. Declare a 2-D array to hold the nine positions in the tic-tac-toe board. 2. Initialize all the nine positions to "E" (needs to be in uppercase). 3. Run the while loop, either till a winner is announced or till you have exhausted all the 9 turns. (Sentinel Loop) 4. Inside the while loop get the input from the user for the position in which the player wishes to place either " " or "O", also check for the condition where the user's enter the value between 1 and 9 only (Loop the condition). 5. Assign " " to player 1 and " " to player 2. 6. Update the appropriate variable created in Step 1: with either " " or " ". 7. When you update the position, you should also make sure that position has not been taken. (For example: Sample Run 2) a. Also, make use of "continue" for the condition if the position is already taken. b. Look for the difference between "break" and "continue", before using. 8. Once the position is updated, check if any of the combination is leading to the victory of the player, there should be a total of 8 possibilities. a. Either of three rows. b. Either of three columns. c. Either of two diagonals. 9. Keep track of how many iterations are carried out, so that you may quit once all the 9 positions are taken. 10. In the end, switch the player's turn. Here is the code for the check box pattern for the game:


We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe