Uploaded by aentuns

tictac

advertisement
c = input()
grid = f"""---------
| {c[0]} {c[1]} {c[2]} |
| {c[3]} {c[4]} {c[5]} |
| {c[6]} {c[7]} {c[8]} |
---------"""
print(grid)
GNF = ["XO_OOX_X_"]
draw = ["XOXOOXXXO"]
x_wins = ["XXXOO__O_", "XOXOXOXXO"]
o_wins = ["XOOOXOXXO"]
impossible = ["XO_XO_XOX", "_O_X__X_X", "_OOOO_X_X"]
if c in GNF:
print("Game not finished")
elif c in draw:
print("Draw")
elif c in x_wins:
print("X wins")
elif c in o_wins:
print("O wins")
elif c in impossible:
print("Impossible")
Download