间隔2秒发牌且有大小王!
# coding:utf-8
#
import random
import time
# 扑克牌54张
poker = [x for x in range(1, 55)]
player = {}
pokers = {} # 每个花色的组合
# 玩家4人 列表
for p in range(1, 5):
player[p] = []
# 4个花色
types = ['♠', '♥', '♦', '♣']
num = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K']
i = 1
for t in types: # 每个人的数量 print(4*13)= 52
for n in num:
pokers[i] = [t, n]
i += 1
pokers[53] = ['j', 'ocker']
pokers[54] = ['J', 'ocker']
# print(pokers)
for i in range(1, 55):
m = random.choice(poker)
poker.remove(m) # 下标为m的移除掉 即随机移除一个重复的
# print(poker)
player[i % 4 + 1].append(m) # 依次给玩家1234加牌 数字
for j in player:
print('player', j)
for x in player[j]:
print(pokers[x][0] + str(pokers[x][1]), end=',')
print()
# [x][0] #取花色 [x][1] #取数字
time.sleep(2)