Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def board(f):
- b1 = (" "+f[7]+" | "+f[8]+" | "+f[9]+" ")
- b2 = ("-----------")
- b3 = (" "+f[4]+" | "+f[5]+" | "+f[6]+" ")
- b4 = ("-----------")
- b5 = (" "+f[1]+" | "+f[2]+" | "+f[3]+" ")
- print(b1)
- print(b2)
- print(b3)
- print(b4)
- print(b5)
- def welcomescreen():
- import random
- f = [" ", " ", " ", " ", " ", " ", " ", " ", " ", " "]
- figures = ["X", "O"]
- figuresc = False
- p1 = input("Hello player one, enter your name:")
- while figuresc == False:
- f1 = input(f"Hello {p1}, what do you choose? Type X, O or Random:")
- if f1 == "X":
- f2 = "O"
- figuresc = True
- elif f1 == "O":
- f2 = "X"
- figuresc = True
- elif f1 == "Random":
- f1 = random.choice(figures)
- if f1 == "X":
- f2 = "O"
- figuresc = True
- elif f1 == "O":
- f2 = "X"
- figuresc = True
- else:
- print("Incorrect input, try again")
- print(f"Your figure is {f1}")
- p2 = input("Hello player two, enter your name:")
- print(f"Hello {p2}, your figure is {f2}")
- def choosing():
- spotchoice = True
- while spotchoice == True:
- ch1 = input(f"Where would you like to place {f1}?")
- if ch1 in [1,2,3,4,5,6,7,8,9] and f[ch1] == " ":
- f[ch1] = f1
- f.pop(f[ch1])
- board(f)
- ch2 = input(f"Where would you like to place {f2}?")
- if ch2 in [1,2,3,4,5,6,7,8,9] and f[ch2] == " ":
- f[ch2] = f2
- f.pop(f[ch2])
- board(f)
- else:
- print("Incorrect input! Try again")
- board(f)
- else:
- print("Incorrect input! Try again")
- board(f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement