Exemplo n.º 1
0
 def __init__(
     self,
     name="Player One",
 ):
     self.name = name
     self.hand = []
     self.library = [DCard.card_dict['Copper']]*7 + [DCard.card_dict['Estate']]*3
     self.discard = []
     self.in_play = []
     self.actions_left = 0
     logging.info('New player: %s' % self.name)
     DUtilities.shuffle(self.library)
Exemplo n.º 2
0
 def draw_card(self):
     logging.debug('%s: Drawing one card.' % self.name)
     try:
         self.hand.append(self.library.pop(0))
     except IndexError: # throws if empty
         logging.debug('%s: Library is empty. Shuffling in discard pile.' % self.name)
         self.library.extend(self.discard)
         self.discard=[]
         DUtilities.shuffle(self.library)
         try:
             self.hand.append(self.library.pop(0))
         except IndexError:
             logging.info('%s: Cannot draw card. Library is empty.' % self.name)
Exemplo n.º 3
0

        
           

if __name__ == '__main__':

    logging.basicConfig(level=logging.DEBUG, format='%(message)s') 

    test_player = Player('Testy McTesterson')
    logging.warning('Adding a Village to the standard starting cards!')
    test_player.library = \
      [DCard.card_dict['Village']]*1 + \
      [DCard.card_dict['Estate']]*3 + \
      [DCard.card_dict['Copper']]*7
    DUtilities.shuffle(test_player.library)
    test_player.print_all()

    test_player.draw_hand()
    test_player.print_all()

    test_player.discard_hand()
    test_player.print_all()

    test_player.draw_hand()
    test_player.print_all()

    test_player.draw_card()
    test_player.print_all()

    test_player.add_action()