Question: 1. Create a flowchart using Raptor and 2. Write Python code that read in the statuses of three cells in a Tic Tac Toe game.

1. Create a flowchart using Raptor and

2. Write Python code that read in the statuses of three cells in a Tic Tac Toe game. We will assume that these cells are in the same row, or in the same diagonal or in the same column. Your task is to check if either the human or the computer has won.

If all cells are occupied by the human, the program must print Congratulations! You won!!

If all cells are occupied by the computer, the program must print I won. Better luck next time.

If a cell contains the value H (C), it means it is occupied by the human (computer). If the cell status is neither H or C, it (the cell) is unoccupied. Try to answer the following questions that help you create the solution.

1. What does the program read? What is the psueodocode for reading?

2. Decide on variable names for storing the values in the three cells. What are the identifiers?

3. Select one of the cells you have identified in the step above. How do you check if the human is occupying the corresponding cell? What is the code for checking it?

4. Select a second identifier (corresponding to a cell) you have listed in Step 2. How do you check that two cells selected in the previous step and this step are occupied by the human? Write the code.

5. How do you check that all of the three cells are occupied by the human? Write the code.

6. Now write the code for checking that all three cells are occupied by the computer.

7. Write the code for printing the messages related to the two possible results: The human wins

or the computer wins.

8. Place the display messages appropriately among the checks in steps 5 and 6.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!