I'm trying to write a game where I play against the computer...and as u see below..I really suck at it..
can someone pleeease help me..I want it to be as simple as possible..


input random
game = raw_input("Your turn. Input the coordinate for your move on the form x,y: ")

for turn in range(9):
def print_board(board):
board = board.replace("_"," ")
print "." + "---." * 3
for bound in [0,3,6]:
print "|",
for sym in board[bound:bound+3]:
print sym, "|",
if bound < 6:
print "\n|" + "---|" * 3
print "\n'" + "---'" * 3

Empty = ' '
Player_X = 'x'
Computer_O = 'o'

a = 0,0
b = 0,1
c = 0,2
d = 1,0
e = 1,1
f = 1,2
g = 2,0
h = 2,1
i = 2,2
winlist = [(a,b,c), (d,e,f), (g,h,i), (a,d,g,), (b,e,h), (c,f,i), (a,e,i), (g,e,c)]

opponent = { Player_X : Computer_O, Computer_O : Player_X }

if winner == player:
print: ("I win!")
if winner == computer:
print: ("You win!")
if winner == none:
print: ("None")

board ()
raw_input ( 'Remi' )

Edited by c_crash: n/a

7 Years
Discussion Span
Last Post by jlm699

1) This program has no indentation. To preserve formatting on this forum you must wrap your code in code tags. However after looking closer at your post it appears that your code has no indentation even in its original form.

2) You need to learn the difference between defining a function and calling one. You should never ever ever ever ever be defining a function inside a loop or any other regular code unless it truly needs to be a dynamic function (which you'll likely never encounter).

Edited by happygeek: fixed formatting

Votes + Comments
good points
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.