'''
斗地主
1.牌堆,54张牌,四种花色,2,3,4,5,6,7,8,9,10,J,Q,K,A,大小王
2.洗牌
3.发牌
'''
import random
class Poke():
flowr=["黑桃","方片","梅花","红桃"]
num=["2","3","4","5","6","7","8","9","10","J","Q","K","A"]
kings={'big':'大王','small':'小王'}
poker=[]
player1=[]
player2=[]
player3=[]
dipai=[]
def __init__(self):
for f in self.flowr:
for n in self.num:
self.poker.append(f+n+' ')
self.poker.append(self.kings['big']+' ')
self.poker.append(self.kings['small']+' ')
#洗牌
def wash(self):
for i in range(54):
index=random.randint(0,53)
self.poker[index],self.poker[i]=self.poker[i],self.poker[index]
#发牌
def fa(self):
for i in range(17):
self.player1.append(self.poker.pop(0))
self.player2.append(self.poker.pop(0))
self.player3.append(self.poker.pop(0))
self.dipai=tuple(self.poker)
#展示
def show(self):
for i in self.player1:
print(i,end='')
print()
print('玩家1↑↑↑')
for i in self.player2:
print(i,end='')
print()
print('玩家2↑↑↑')
for i in self.player3:
print(i,end='')
print()
print('玩家3↑↑↑')
for i in self.dipai:
print(i,end='')
print()
print('底牌↑↑↑')
p=Poke()
p.wash()
p.fa()
p.show()