0

Hi, everyone. I am making a tic - tac - toe game and I am having some trouble.
As you can see I have made good progress:

from os import system
a = "1"; b = "2"; c = "3"; d = "4"; e = "5"; f = "6"; g = "7"; h = "8"; i = "9";
while True:
    system("cls") #OS code, for linux change to "clear"
    print a, b, c,"\n", d , e, f,"\n", g, h, i
    u = raw_input('Enter number [X]  ')
    if u == "1":
        a = "x"
    if u == "2":
        b = "x"
    if u == "3":
        c = "x"
    if u == "4":
        d = "x"
    if u == "5":
        e = "x"
    if u == "6":
        f = "x"
    if u == "7":
        g = "x"
    if u == "8":
        h = "x"
    if u == "9":
        i = "x"
    else:
        print "Please enter a valid number."

I haven't got round to giving player O a turn yet, but I think I have gotten off to a bad start
:(
Because now, I don't know how to continue or how the program will detect if one player has won (with 3 in a row).

2
Contributors
1
Reply
4
Views
5 Years
Discussion Span
Last Post by pyTony
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.