Skip to content

Commit

Permalink
added numbered play field
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Bender committed Mar 29, 2018
1 parent 7248a3f commit 59c7ff4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions TicTacToe.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def playAgain():
return input().lower().startswith('y')

def makeMove(board, letter, move):
if board[move] == ' ':
if isSpaceFree(board,move):
board[move] = letter
else:
raise Exception("makeMove: the field is not empty!")
Expand Down Expand Up @@ -68,7 +68,7 @@ def getBoardCopy(board):

def isSpaceFree(board, move):
# Return true if the passed move is free on the passed board.
return board[move] == ' '
return board[move].isdigit()

def getPlayerMove(board):
# Let the player type in his move.
Expand Down Expand Up @@ -141,6 +141,8 @@ def main():
while True:
# Reset the board
theBoard = [' '] * 10
for i in range(9,0,-1):
theBoard[i] = str(i)
playerLetter, computerLetter = inputPlayerLetter()
turn = whoGoesFirst()
print('The ' + turn + ' will go first.')
Expand Down

0 comments on commit 59c7ff4

Please sign in to comment.