tic tac toe cbse pyhton
TRANSCRIPT
-
7/25/2019 tic tac toe cbse pyhton
1/2
def print_board(board):
print "The board look like this: \n"
for i in range(3):print " ",
for j in range(3):if board[i*3+j] !:
print #,elif board[i*3+j] $:
print %,elif board[i*3+j] & '!:
print board[i*3+j]'!,else:
print ,
if j & :print " ",
print
if i & :print "'''''''''''''''''"
else:print
def print_instrtion():print "lease se the follo-ing ell n.bers to .ake /or .o0e"print_board([,3,1,2,,4,5,6,!$])
def get_inpt(trn):
0alid 7alse-hile not 0alid:
tr/:ser ra-_inpt("8here -old /o like to plae " + trn
+ " (!'6)9 ")ser int(ser)if ser ! and ser ; 6:
retrn ser'!else:
print "That is not a 0alid .o0e& lease tr/again
-
7/25/2019 tic tac toe cbse pyhton
2/2
def ?it_ga.e(board,.sg):print_board(board)print .sg?it()
def .ain():
@ setp ga.e@ alternate trns@ hek if -in or end@ ?it and sho- the board
print_instrtion()
board []for i in range(6):
board