Ejemplo n.º 1
0
 def print_all(self):
     logging.info('-------------------------------------')
     logging.info('%s status:' % self.name)
     logging.info('-------------------------------------')
     logging.info('Library  : ' + str(self.library))
     logging.info('Discard  : ' + str(self.discard))
     logging.info('Hand     : ' + str(self.hand))
     logging.info('In Play  : ' + str(self.in_play))
     logging.info('Actions : ' + str(self.actions_left))
     DUtilities.print_zone_nicely(self.hand)
     logging.info('-------------------------------------')
Ejemplo n.º 2
0
def main() :
  logging.info('--> Starting the game. Shuffle the library and draw 5 cards.')

  players = []

  player_one = DPlayer.Player('Player 1')
  player_one.draw_hand()
  player_one.print_all()
  players.append(player_one)

  player_two = DPlayer.Player('Player 2')
  player_two.draw_hand()
  player_two.print_all()
  players.append(player_two)

  n_players = len(players)
  n_turns = 20;
  for i in range(n_turns):  
    
    # A turn has the following actions in order:
    #  - Play action cards
    #  - Play money in any order
    #  - Buy cards, placing them in the discard pile
    #  - Discard remaining cards in hand
    #  - Draw a new hand of 5 cards
    logging.info('\n === Turn ' + str(i+1) + ' === ')

    active_player_index = i % n_players
    active_player = players[active_player_index]

    #print_all()
    logging.info('Stockpile:')
    DUtilities.print_zone_nicely(stockpile)

    dumb_buy_CE_only(active_player)
    active_player.discard_hand()
    active_player.draw_hand()
    active_player.print_all()

    if is_game_over(): break 

  for player in players:
      logging.info('%s: %i victory points' % (
          player.name,
          player.count_victory_points(),
      ))