题目:
设计一个简单的四人制扑克牌游戏,能够完成以下功能:
1. 洗牌
2. 发牌
3.自定义规则,在每轮单张出牌时,判定赢家
4.自定义规则,判定最终的赢家
规则简化版:
仅能出单张牌,且出牌时,每个人出的是自己手中牌中刚好能压过上家的最小牌,最先出完的为赢家
import random
from random import choice
flower = ['\u2660','\u2663','\u2665','\u2666']
pai = ['3','4','5','6','7','8','9','10','J','Q','K','A','2']
list = []
list0 = []#储存发的牌
list1 = []
list2 = []
list3 = []
value = []
value0 = []#储存牌代表的值
value1 = []
value2 = []
value3 = []
l00 = []#储存进行升序排序后的牌
l11 = []
l22 = []
l33 = []
for i in flower:
for j in pai:
list.append(i+j)
for i in range(4):
for j in range(13):
value.append(j)
d = dict(zip(list,value))
for i in range(13):
for j in range(4):
if(j == 0):
k = choice(list)#随机选牌
for x in range(len(list)):
if(k == list[x]):#和链表的牌进行匹配,删掉对应项
value0.append(d[k])
list.pop(x)
break
list0.append(k)
if(j == 1):
k = choice(list)
for x in range(len(list)):
if (k == list[x]):
value1.append