0

Problem 2. tttCheckMove()
Write a function named tttCheckMove() that checks whether or not a TicTacMove is on an empty space
on a TTT board.
Input (two parameters):
· Parameter 1: A string of 9 characters denoting the state of a TTT board. Each character in the
string indicates the state of one TicTacToe square – an ‘X’ or ‘O’ if the square is occupied, a ‘-‘
if it is not. The squares are numbered left to right and from the bottom up:

|6|7|8|
|3|4|5|
|0|1|2| ---- simulates tic tac toe board

For example, this TicTacToe board
| | | |
|X| | | ---- X is in space '3'
| | | |
is represented by the string '---X-----'.
· Parameter 2: An int from 0 to 8 inclusive, representing a TicTacToe move.
Output:
Return True if the move is in an unoccupied space, otherwise return False.
Here is sample output:

from ticTacToe import *
board = '----X----'
move = 1
tttCheckMove(board, move)
False
row = 0
column = 1
tttCheckMove(board, row, column)
True

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by minimee120
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.