import random
huase = ['黑桃','红心','方块','草花']
num = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']
# r = random.choice(huase)
# total2 = list(map(lambda x: r + x, num))
total = []
for i in huase:
total3 = list(map(lambda x: i + x, num))
total.extend(total3)
# 玩家 = [[],[],[],[]]
random.shuffle(total)
玩家1 = total[0:13]
玩家2 = total[13:26]
玩家3 = total[26:39]
玩家4 = total[39:]
# print(玩家1,len(玩家1))
# print(玩家2,len(玩家2))
# print(玩家3,len(玩家3))
# print(玩家4,len(玩家4))
def printinfo(listinfo,count):
方块 = []
黑桃 = []
红心 = []
草花 = []
for i in listinfo:
if '方块' in i:
方块.append(i[2:])
elif '黑桃' in i:
黑桃.append(i[2:])
elif '草花' in i:
草花.append(i[2:])
else:
红心.append(i[2:])
黑桃 = sorted(黑桃, key=lambda x:num.index(x), reverse=True)
草花 = sorted(草花, key=lambda x:num.index(x), reverse=True)
方块 = sorted(方块, key=lambda x:num.index(x), reverse=True)
红心 = sorted(红心, key=lambda x:num.index(x), reverse=True)
msg = '''
玩家%s的牌
黑桃:%s
红心:%s
方块:%s
草花:%s
''' %(count,黑桃,红心,方块,草花)
print(msg,end='------------')
count = 1
for i in [玩家1,玩家2,玩家3,玩家4]:
printinfo(i, count)
count += 1