Last active
May 29, 2020 08:37
-
-
Save bulislaw/8e11ba9cb6a69ce06777b28cdaf6e179 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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