import random class Card( object ): count = 0 def __init__( self , number , pattern = '' , is_cover = 1 ): self.number = number self.pattern = pattern self.is_cover = is_cover Card.count += 1 def setNumber( self , number ): self.number = number return None def setPattern( self , pattern ): self.pattern = pattern return None def setIs_cover( self , is_cover ): self.is_cover = is_cover return None def getNumber( self ): return None if self.is_cover else self.number def getPattern( self ): return None if self.is_cover else self.pattern def getIs_cover( self ): return self.is_cover def getCount( self ): return self.count def setCard( self ): self.setNumber( self.number % 13 if self.number % 13 else 13 ) self.setPattern( ( self.number - 1 ) // 13 + 3 ) self.setIs_cover( 0 ) def card_info( self ): return ( self.getNumber() , self.getPattern() , self.getIs_cover() ) cards = [ i for i in range( 1 , 53 ) ] players = [ [] , [] , [] , [] ] def shuffle_cards(): global cards return random.shuffle( cards ) #test # c = Card( 2 ) # c.setCard() # print( c.card_info() ) def deal_card(): global cards global players shuffle_cards() for i in cards: c = Card( i ) c.setCard() players[ cards.index( i ) // 13 ].append( c.card_info() ) deal_card() for i in players: print( i )