andewK

Untitled

May 27th, 2021
812
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. str = input("Enter pole> ")
  2.  
  3. print(f"""{"-" * 9}
  4. | {str[0]} {str[1]} {str[2]} |
  5. | {str[3]} {str[4]} {str[5]} |
  6. | {str[6]} {str[7]} {str[8]} |
  7. {"-" * 9}""")
  8.  
  9. for b, s in [[0, 1], [3, 1], [6, 1], [0, 3], [1, 3], [2, 3], [0, 4], [2, 2]]:
  10.     h = "".join([str[i] for i in range(b, b + s * 3, s)])
  11.     if "XXX" in h:
  12.         print("X win")
  13.         exit()
  14.     elif "OOO" in h:
  15.         print("O win")
  16.         exit()
  17.  
  18. if str.count("_"):
  19.     print("Not finished yet")
  20. else:
  21.     print("draw")
  22.  
RAW Paste Data