Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please note i need using basic c and (if) and (else) and (switch) and ( while loop ) or (for loop ) ( nested loop

image text in transcribed

image text in transcribed

image text in transcribed

please note i need using basic c and (if) and (else) and (switch) and ( while loop ) or (for loop ) ( nested loop are ok ) ( and do while loop ) this what we have coverd so far ! PLZ I NEED IT ASAP!

uI Tac-To Problem Statement Write a C program to implement a two-player tic-tac-toe game Background Tic-tac-toe is a game where a chart of 3 x 3 blank squares is represented. The game is played by two players. Each player is assigned an individual symbol (e.g., player 1 is assigned the symbol 'x' and player 2 is assigned the symbol 'o'). Once one player chooses any empty square in the chart to put his symbol the next turn goes to the other player to choose any other empty square in the chart. This process is repeated until a decision is made as follows 1) If any vertical column, horizontal row, or a diagonal line is filled by the same symbol, the player assigned to that respective symbol wins the game. The following scenarios show the winning combination for player 1 with symbol x: 2) If there are no blank squares and if nobody wins the game, the game is decided as Draw (Hints: Assume the symbol of player 1 is 1 and player 2 is 2. Declare nine variables as x11, x12, ..., X32, x33, etc. that would save the values selected by the respective player. For example, if player 1 chooses the square on row 1 and column 2, the value of variable x12 would be set as 1. In the next move by player 2, if he chooses the square on row 1 and column 3, the value of variable x13 is set as 2. Once, a square is filled by either of the players, the square can not be chosen by any of the players. If, any of the two players selects an already filled square or wrong input (e.g., row 4 column 3) the program should stop and exit execution. Every time, any player selects a square to be filled, your program must check for any winning combination and draw conditions.) You should write all your code inside the main function, i.e., do not use user-defined functions. Further you may only use the following C statements to achieve this task: for, while, if, and switch. Sample Output A sample output of your program is shown in the following screenshots

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Answered: 1 week ago

Answered: 1 week ago