Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = {'1':'1','2':'2','3':'3','4':'4','5':'5',
- '6':'6','7':'7','8':'8','9':'9'}
- mogeba = (('1','2','3'),('2','5','8'),
- ('4','5','6'),('7','8','9'),
- ('1','4','7'),('3','6','9'),
- ('1','5','9'),('3','5','7'))
- def cxrili():
- print('-------------')
- print('|',a['1'],'|',a['2'],'|',a['3'],'|')
- print('-------------')
- print('|',a['4'],'|',a['5'],'|',a['6'],'|')
- print('-------------')
- print('|',a['7'],'|',a['8'],'|',a['9'],'|')
- print('-------------')
- def in_x(a):
- x = input('x-is svlaa :')
- a[x] = 'x'
- def in_o(a):
- x = input('o-is svlaa :')
- a[x]= 'o'
- def win():
- for i in mogeba:
- count_x = 0
- count_o = 0
- for j in i:
- if 'x' == a[j]:
- count_x+=1
- if count_x == 3:
- return 'win x'
- elif 'o' == a[j]:
- count_o+=1
- if count_o == 3:
- return 'win o'
- return ""
- i = 1
- while i <=5:
- cxrili()
- in_x(a)
- win_x = win()
- if win_x :
- print(win_x)
- break
- if i==5:
- cxrili()
- print('nichiaaa')
- break
- cxrili()
- in_o(a)
- win_o = win()
- if win_o :
- print(win_o)
- break
- i+=1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement