Skip to content

Instantly share code, notes, and snippets.

@bulislaw
Last active May 29, 2020 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bulislaw/8e11ba9cb6a69ce06777b28cdaf6e179 to your computer and use it in GitHub Desktop.
Save bulislaw/8e11ba9cb6a69ce06777b28cdaf6e179 to your computer and use it in GitHub Desktop.
board2=['','','','','','','','','_']
#####choose if x or 0
positionlist=[]
first='X'
second='0'
print('{}|{}|{}\n{}|{}|{}\n{}|{}|{}'.format(*board2))
response=input("do you want to be 'X' or 'Y'?")
def switch_player(current_player):
if current_player == first:
return second
elif current_player == second:
return first
while response is first:
if position in range(0,9) and board2[position] != '_':
print('wrong choice')
position=int(input('choose position please'))
else:
board2[position] = 'X'
print('{}|{}|{}\n{}|{}|{}\n{}|{}|{}'.format(*board2))
position=int(input('choose position please'))
positionlist.append(position)
print('the position list is:', positionlist)
while response is second:
if position in range(0,9) and board2[position] !='_':
print('wrong choice')
position=int(input('choose position please'))
else:
board2[position] = 'Y'
print('{}|{}|{}\n{}|{}|{}\n{}|{}|{}'.format(*board2))
position=int(input('choose position please'))
positionlist.append(position)
print('the position list is:', positionlist)
###conditions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment