user211985
发表于 2018-1-22 13:20:13
厉害,学习学习
Kevin123123
发表于 2018-2-18 22:02:30
123
soloattack
发表于 2018-3-2 10:31:29
看看
皮皮小发
发表于 2018-3-2 10:52:00
向大佬学习
kyza90123
发表于 2018-3-4 22:18:51
学习学习大佬
JAY饭
发表于 2018-3-8 08:51:36
import time
class jingziqi():
def __init__(self,lst):
self.jin = lst
self.che = []
self.sho = {}
self.jud = 0
def coo(self):
for ver in range(3):
acr = []
shu = []
for each in range(3):
acr.append()
shu.append()
self.che.append(acr)
self.che.append(shu)
xie1 = []
xie2 = []
a,b,c,d = 0,0,0,2
for t in range(3):
xie1.append()
xie2.append()
a += 1
b += 1
c += 1
d -= 1
self.che.append(xie1)
self.che.append(xie2)
def check(self):
for i in range(5):
self.sho = 0
self.eva_2()
for line in self.che:
cot_d = {}
cot_d,cot_d,cot_d = 0,0,0
for each in line:
temp = self.jin]]
if temp == 0:
cot_d += 1
elif temp == 1:
cot_d += 1
else:
cot_d += 1
self.eva_1(cot_d,line)
def eva_1(self,dic,lst):
if dic == 3:
self.jud = 1
elif dic == 1 and dic == 2:
for i in lst:
if not self.jin]]:
self.sho = i
elif dic == 1 and dic == 2:
for i in lst:
if not self.jin]]:
self.sho = i
def eva_2(self):
if self.jin == 0:
self.sho =
for s in [,,,]:
if not self.jin]]:
self.sho = s
break
for c in [,,,]:
if not self.jin]]:
self.sho = c
break
def ai_play(self):
for dec in range(5):
if self.sho:
c = self.sho
self.jin]] = 2
if dec == 0:
self.jud = 2
break
def man_play(self):
while True:
temp = input('you:').split(',')
a,b = int(temp),int(temp)
if not self.jin:
self.jin = 1
break
def show(self):
sign = 0
for line in self.jin:
print('',end='')
for each in line:
print(each,end=' ')
if not each: sign = 1
print()
print('')
if not sign:
self.jud = 3
if self.jud:
if self.jud == 1: print('You Win~')
elif self.jud == 2: print('AI Win~')
else: print('Dogfall')
return 1
def ini(self):
for line in range(3):
for each in range(3):
self.jin = 0
def chess():
board = [ for i in range(3)]
ai = jingziqi(board)
ai.coo()
while True:
if ai.show() == 1:
temp = input('continue?y or n: ')
if temp == 'n':
break
else:
print('')
ai.ini()
ai.show()
ai.man_play()
time.sleep(0.5)
ai.check()
ai.ai_play()
chess()
wenweno
发表于 2018-3-17 15:59:01
{:5_90:}
昔日少年郎
发表于 2018-4-5 21:15:59
看
水泥工艺学
发表于 2018-4-16 22:45:01
学习一下
aggies
发表于 2018-5-11 16:26:55
学习学习
happyswear
发表于 2018-5-11 23:29:00
顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶
15779388639
发表于 2018-5-12 14:19:05
参考参考 学习学习
小小瓜
发表于 2018-5-29 09:21:05
学习学习
未来的PY大佬
发表于 2018-5-29 16:35:46
感谢分享,学习学习
九九八十一
发表于 2018-5-29 22:18:22
开始学习
人一样的神
发表于 2018-5-30 12:40:42
KK
Pufffish
发表于 2018-6-22 17:49:00
nb
ronin81
发表于 2018-6-28 09:26:28
厉害了
Hok
发表于 2018-6-28 10:23:48
学习
和光123同尘
发表于 2018-7-11 19:09:45
666