import random
qi=['2','2','2','2','3','3','3','3','4','4','4','4','5','5','5','5','6','6','6','6','7','7','7','7','8','8','8','8','9','9','9','9','10','10','10','10','J','J','J','J','Q','Q','Q','Q','K','K','K','K','A','A','A','A','大','小']
pu={'3':'1','4':'2','5':'3','6':'4','7':'5','8':'6','9':'7','1':'8','J':'9','Q':'1','K':'11','A':'12','2':'13','大':'14','小':'15'}
zha={'3333':'16','4444':'17','5555':'18','6666':'19','7777':'20','8888':'21','9999':'22','1111':'23','JJJJ':'24','QQQQ':'25','KKKK':'26','AAAA':'27','2222':'28','大小':'29'}
dui={'33':'1','44':'2','55':'3','66':'4','77':'5','88':'6','99':'7','11':'8','JJ':'9','QQ':'10','KK':'11','AA':'12','22':'13'}
san={'333':'1','444':'2','555':'3','666':'4','777':'5','888':'6','999':'7','111':'8','JJJ':'9','QQQ':'10','KKK':'11','AAA':'12','222':'13'}
pai=0
shang=0
p1=[]
zh=53
while pai<=27:
chu=random.randint(0,zh)
zh-=1
ban=qi[chu]
p1.append(ban)
pai+=1
qi.pop(chu)
p2=qi
while True:
p1.sort()
print("play1你当前的牌:",end='')
for nm in p1:
print(nm,end=' ')
print('\n')
dan=input('请输入你想出的牌(十用“1”代替,二炸弹即为“2222”以此类推,目前不支持如飞机等这种牌不一样的):')
chang=len(dan)
if p1==[]:
break
if chang==1:
if dan=='1':
hh=pu[dan]
hh=int(hh)
if shang<hh:
print('play1:',dan)
b='10'
p1.remove(b)
shang=int(hh)
else:
print("nm$l")
exit()
else:
hh=pu[dan]
hh=int(hh)
if shang<hh:
print('play1:',dan)
for b in dan:
p1.remove(b)
shang=int(hh)
else:
print("nm$l")
exit()
elif chang==2:
if dan=='11':
hh=dui[dan]
hh=int(hh)
if shang<hh:
print('play1:',dan)
b='10'
i=0
while i<2:
p1.remove(b)
i+=1
shang=int(hh)
else:
print("nm$l")
exit()
else:
hh=dui[dan]
hh=int(hh)
if shang<hh:
print('play1:',dan)
for b in dan:
p1.remove(b)
shang=int(hh)
else:
print("nm$l")
exit()
elif chang==3:
if dan=='111':
hh=san[dan]
hh=int(hh)
if shang<hh:
print('play1:',dan)
b='10'
i=0
while i<2:
p1.remove(b)
i+=1
shang=int(hh)
else:
print("nm$l")
exit()
else:
hh=san[dan]
hh=int(hh)
if shang<hh:
print('play1:',dan)
for b in dan:
p1.remove(b)
shang=int(hh)
else:
print("nm$l")
exit()
elif chang==4:
if dan=='1111':
hh=pu[dan]
hh=int(hh)
if shang<hh:
print('play1:',dan)
b='10'
i=0
while i<2:
p1.remove(b)
i+=1
shang=int(hh)
else:
print("nm$l")
exit()
else:
hh=zha[dan]
hh=int(hh)
if shang<hh:
print('play1:',dan)
for b in dan:
p1.remove(b)
shang=int(hh)
else:
print("nm$l")
exit()
else:
print("nm$l")
p2.sort()
print("play2你当前的牌:",end='')
for nm in p2:
print(nm,end=' ')
print('\n')
dan=input('请输入你想出的牌(十用“1”代替,二炸弹即为“2222”以此类推,目前不支持如飞机等这种牌不一样的):')
chang=len(dan)
if p1==[]:
break
if chang==1:
if dan=='1':
hh=pu[dan]
hh=int(hh)
if shang<hh:
print('play1:',dan)
b='10'
p1.remove(b)
shang=int(hh)
else:
print("nm$l")
exit()
else:
hh=pu[dan]
hh=int(hh)
if shang<hh:
print('play1:',dan)
for b in dan:
p1.remove(b)
shang=int(hh)
else:
print("nm$l")
exit()
elif chang==2:
if dan=='11':
hh=dui[dan]
hh=int(hh)
if shang<hh:
print('play1:',dan)
b='10'
i=0
while i<2:
p1.remove(b)
i+=1
shang=int(hh)
else:
print("nm$l")
exit()
else:
hh=dui[dan]
hh=int(hh)
if shang<hh:
print('play1:',dan)
for b in dan:
p1.remove(b)
shang=int(hh)
else:
print("nm$l")
exit()
elif chang==3:
if dan=='111':
hh=san[dan]
hh=int(hh)
if shang<hh:
print('play1:',dan)
b='10'
i=0
while i<2:
p1.remove(b)
i+=1
shang=int(hh)
else:
print("nm$l")
exit()
else:
hh=san[dan]
hh=int(hh)
if shang<hh:
print('play1:',dan)
for b in dan:
p1.remove(b)
shang=int(hh)
else:
print("nm$l")
exit()
elif chang==4:
if dan=='1111':
hh=pu[dan]
hh=int(hh)
if shang<hh:
print('play1:',dan)
b='10'
i=0
while i<2:
p1.remove(b)
i+=1
shang=int(hh)
else:
print("nm$l")
exit()
else:
hh=zha[dan]
hh=int(hh)
if shang<hh:
print('play1:',dan)
for b in dan:
p1.remove(b)
shang=int(hh)
else:
print("nm$l")
exit()
else:
print("nm$l")