Skip to content

Commit

Permalink
added random seed in main()
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Bender committed Mar 29, 2018
1 parent 59c7ff4 commit 135a9df
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions TicTacToe.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def inputPlayerLetter():

def whoGoesFirst():
# Randomly choose the player who goes first.
random.seed()
if random.randint(0, 1) == 0:
return 'computer'
else:
Expand Down Expand Up @@ -81,7 +80,6 @@ def getPlayerMove(board):
def chooseRandomMoveFromList(board, movesList):
# Returns a valid move from the passed list on the passed board.
# Returns None if there is no valid move.
random.seed()
possibleMoves = []
for i in movesList:
if isSpaceFree(board, i):
Expand Down Expand Up @@ -137,7 +135,7 @@ def isBoardFull(board):

def main():
print('Welcome to Tic Tac Toe!')

random.seed()
while True:
# Reset the board
theBoard = [' '] * 10
Expand Down

0 comments on commit 135a9df

Please sign in to comment.