Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
