Skip to content

Instantly share code, notes, and snippets.

@sai-sondarkar
Created April 7, 2019 11:15
Show Gist options
  • Save sai-sondarkar/d7be35b131508acea464fb3d8a2feead to your computer and use it in GitHub Desktop.
Save sai-sondarkar/d7be35b131508acea464fb3d8a2feead to your computer and use it in GitHub Desktop.
print(' Welcome to the nikils Tic Tac Toe' )
while True:
board = [' ']* 10
player1_marker,player2_marker = player_input()
turn = choose_first()
print( turn + " Will be playing first ")
play_game = input (' Are you ready to start the game yes or no ')
if play_game.lower()[0] == 'y':
game_on = True
else:
game_on = False
while game_on :
if turn == 'Player 1':
# player 1 turn
display_board(board)
position = player_choice(board)
place_marker(board,player1_marker,position)
if win_check(board,player1_marker):
display_board(board)
print(" Player 1 has won the game, congo !!")
game_on = False
else:
if full_board_check(board) :
display_board(board)
print("Game draw !")
break
else:
turn = 'Player 2'
else:
#Player 2 Turn
display_board(board)
position = player_choice(board)
place_marker(board,player2_marker,position)
if win_check(board,player2_marker):
display_board(board)
print(" Player 2 has won the game, congo !!")
game_on = False
else:
if full_board_check(board) :
display_board(board)
print("Game draw !")
break
else:
turn = 'Player 1'
if not replay():n
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment