parent
cdb7fddd3a
commit
384ad93589
|
@ -530,8 +530,8 @@ import random
|
|||
class Card(object):
|
||||
"""一张牌"""
|
||||
|
||||
def __init__(self, suite, face):
|
||||
self._suite = suite
|
||||
def __init__(self, suit, face):
|
||||
self._suit = suit
|
||||
self._face = face
|
||||
|
||||
@property
|
||||
|
@ -539,8 +539,8 @@ class Card(object):
|
|||
return self._face
|
||||
|
||||
@property
|
||||
def suite(self):
|
||||
return self._suite
|
||||
def suit(self):
|
||||
return self._suit
|
||||
|
||||
def __str__(self):
|
||||
if self._face == 1:
|
||||
|
@ -553,7 +553,7 @@ class Card(object):
|
|||
face_str = 'K'
|
||||
else:
|
||||
face_str = str(self._face)
|
||||
return '%s%s' % (self._suite, face_str)
|
||||
return '%s%s' % (self._suit, face_str)
|
||||
|
||||
def __repr__(self):
|
||||
return self.__str__()
|
||||
|
@ -563,8 +563,8 @@ class Poker(object):
|
|||
"""一副牌"""
|
||||
|
||||
def __init__(self):
|
||||
self._cards = [Card(suite, face)
|
||||
for suite in '♠♥♣♦'
|
||||
self._cards = [Card(suit, face)
|
||||
for suit in '♠♥♣♦'
|
||||
for face in range(1, 14)]
|
||||
self._current = 0
|
||||
|
||||
|
@ -616,7 +616,7 @@ class Player(object):
|
|||
|
||||
# 排序规则-先根据花色再根据点数排序
|
||||
def get_key(card):
|
||||
return (card.suite, card.face)
|
||||
return (card.suit, card.face)
|
||||
|
||||
|
||||
def main():
|
||||
|
|
Loading…
Reference in New Issue