Question: Exercise 1 : Write a function that creates an n by n matrix ( of list of lists ) which will represent the state of
Exercise : Write a function that creates an by matrix of list of lists which will represent the state of a Tie Tac Toe game. Let and represent empty, X and O respectively.
Exercise : Write a function that takes integers and as input and draws a by game board. For example the following is a board:
Exercise : Modify exercise so that it takes a matrix of the form from exercise and draws a tictactie board with Xs and Os
Exercise : Write a function that takes a by matrix representing a tictactoe game, and returns or indicating the game is incomplete, the game is a draw, player has won, or player has one, respectively.
Here are some example inputs you can use to test your code:
winneris
winneris
winnerisalso
nowinner
alsonowinner
Exercise : Write a function that takes a game board, player number, and coordinates and places X or O in the correct location of the game board. Make sure that you only allow filling previously empty locations. Return True or False to indicate successful placement of X or O
Exercise : Modify Exercise to show column and row labels so that players can specify location using A or C
Exercise : Write a function that takes a board, player number, and location specified as in exercise and then calls exercise to correctly modify the board.
# Write you solution here
:
Exercise : Write a function that takes a game board, player number, and coordinates and places X or O in the correct location of the game board. Make sure that you only allow filling previously empty locations. Return True or False to indicate successful placement of X or O
Exercise : Modify Exercise to show column and row labels so that players can specify location using A or C
Exercise : Write a function that takes a board, player number, and location specified as in exercise and then calls exercise to correctly modify the board.
# Write you solution here
:
:
# Test your solution here
Exercise : Write a function is called with a board and player number, takes input from the player using python's input, and modifies the board using your function from exercise Note that you should keep asking for input until you have gotten a valid input that results in a valid move.
# Write you solution here
:
:
# Test your solution here
Exercise : Use all of the previous exercises to implement a full tictactoe game, where an appropriate board is drawn, players are repeatedly asked for a location coordinates of where they wish to place a mark, and the game status is checked until a player wins or a draw occurs.
# Write you solution here
:
# Test your solution here
:
Exercise : Test that your game works for Tic Tac Toe.
# Test your solution here
:
Exercise : Advanced Challenge Develop a version of the game where one player is the computer. Note that you don't need to do an extensive seach for the best move. You can have the computer simply protect against loosing and otherwise try to win with straight or diagonal patterns.
# Write you solution here
:
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
