part3
2012-06-13 17:12
28 查看
def is_rank_x(self,x):
if x == 10:
set_royal_flush = set([10,11,12,13,14])
color = self.cards[0].color
for card in self.cards:
if card.value in set_royal_flush:
set_royal_flush.remove(card.value)
if color != card.color:
return False
if set_royal_flush == set([]):
return True
if x == 9:
list_cards_values = []
color = self.cards[0].color
for card in self.cards:
if card.color != color:
return False
list_cards_values.append(card.value)
list_cards_values.sort()
for i in range(1,len(list_cards_values)):
if list_cards_values[i] - list_cards_values[i-1] != 1:
return False
return True
if x == 8:
list_cards_values = []
for card in self.cards:
list_cards_values.append(card.value)
for value in list_cards_values:
if list_cards_values.count(value) >= 4:
return True
return False
if x == 10:
set_royal_flush = set([10,11,12,13,14])
color = self.cards[0].color
for card in self.cards:
if card.value in set_royal_flush:
set_royal_flush.remove(card.value)
if color != card.color:
return False
if set_royal_flush == set([]):
return True
if x == 9:
list_cards_values = []
color = self.cards[0].color
for card in self.cards:
if card.color != color:
return False
list_cards_values.append(card.value)
list_cards_values.sort()
for i in range(1,len(list_cards_values)):
if list_cards_values[i] - list_cards_values[i-1] != 1:
return False
return True
if x == 8:
list_cards_values = []
for card in self.cards:
list_cards_values.append(card.value)
for value in list_cards_values:
if list_cards_values.count(value) >= 4:
return True
return False
相关文章推荐
- Hyper-V 3.0功能部署PART 7:复制功能测试
- VMware Horizon View 7: Add Microsoft RDS Farm [Part 4]
- SVM入门(二)线性分类器Part 1
- Dora,this is a new day - (Third part)
- [原创] 在线音乐API的研究 (Part 2.1)
- 【angular】Type Component is part of the declarations of 2 modules
- c++ code for Discriminatively Trained Deformable Part Models
- 【angular】Type Component is part of the declarations of 2 modules
- Stanford Algorithms: Design and Analysis, Part 2[week 1]
- 《PCL点云库学习&VS2010(X64)》Part 46 点云分类—画刷分类
- 使用Pixel Bender Toolkit制作特效——给过滤器增加参数(Part 3)
- C++程序员眼中的go Part 3
- Explaining Delegates in C# - Part 1 (Callback and Multicast delegates)
- 《T-SQL查询》读书笔记Part 3.索引的基本知识
- POJ 3007 Organize Your Train part II
- Part Ⅰ | 你有465个APP请查收!
- Deformable Part Model的学习
- SCRAPY_part7_杂记
- 1.3节 逻辑门与二进制数 part5
- part-aligned系列论文:1707.Deep Representation Learning with Part Loss for Person ReID 论文阅读笔记