Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) The main program controls the game. a. It asks the user to start a game : if the response is not o or O,

1) The main program controls the game.
a. It asks the user to start a game : if the response is not o or O, the program ends; If the response is o
or O, it leads the game by using the following operations :
i. erase the table (with function eraseTable(tab)).
ii. display the table (with function displayble(tab)).
iii. play a step (with function play(tab, player) including the request made to the player for the new
position).
iv. verify if the player has won or if it is a draw (with function verifyWin(tab)).
v. if the game is not completed, play again a step with the other player (from iii).
Note: the array of the game table is created in the main part of the program in a4q2.py and is passes as
reference to other functions.
b. after each game, you are asked to start another game (restart from a.).
2) the function verifyWin call the following functions:
a. testRows(tab) to check if a row has won.
b. testCols(tab) to check if a column has won.
c. testDiags(tab) to check if a diagonal has won.
d. testDraw(tab) to check for a draw.
The program runs in python

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

What are 3 benefits of the FAST program: 1. 2

Answered: 1 week ago

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago