Ejemplo n.º 1
0
 def __init__(self, player_bots):
     if len(player_bots) != 4:
         print ("Invalid player num != 4")
         sys.exit()
 
     self.db = {}  
     self.htapi = Htapi(is_debug=True)
     self.game_heart_cards = self.htapi.get_cards_by_suit(self.htapi.get52cards(), 'H')
     
     # Save bot object into self.player_bots 
     self.player_tups = []
     id = 0
     for p in player_bots:
         player_tup = {
             # Constant data
             'bot': p, 'name': p.get_name(), 'id': id,
             # Deal data
             'hand_origin': [], 'recv3': [], 'pass3': [],
             'hand': [], 'pick': [], 'round_pick': [], 'shoot': [], 'expose': False, 'score': 0, 'shoot_moon': False,
             # Game data 
             'score_game': 0,
             # MISC data 
             'score_accl': 0, 'shoot_moon_accl': 0, 'score_negative_accl': 0,
             'winner': [0, 0, 0, 0],
                         }
         self.player_tups.append(player_tup)
         self.htapi.msg("Add new player: " + player_tup['name'])
         id += 1
     
     self.db['dealNumber'] = 0
     self.db['gameNumber'] = 0
Ejemplo n.º 2
0
def unitest():
    htapi = Htapi()
    allcards = htapi.get52cards()
    random.shuffle(allcards)
    print (format(allcards))
    print (format(htapi.get_cards_by_suit(allcards, 'S')))
    print (format(htapi.find_card(allcards, Card('2H'))))
Ejemplo n.º 3
0
    def __init__(self, name, is_debug=False):
        super(HacBotII, self).__init__(name)

        self.htapi = Htapi(is_debug=is_debug)

        self.players = {}
        self.stat = {}
        self.stat['roundCard'] = []
        self.stat['usedCard'] = []
        self.stat['nextPlayers'] = []

        self.big_rank_cards = [
            Card('AS'),
            Card('KS'),
            Card('JS'),
            Card('TS'),
            Card('AH'),
            Card('KH'),
            Card('QH'),
            Card('JH'),
            Card('TH'),
            Card('AD'),
            Card('KD'),
            Card('QD'),
            Card('JD'),
            Card('TD'),
            Card('AC'),
            Card('KC'),
            Card('QC'),
            Card('JC'),
            Card('TC'),
        ]

        self.score_cards = [
            Card("QS"),
            Card("TC"),
            Card("2H"),
            Card("3H"),
            Card("4H"),
            Card("5H"),
            Card("6H"),
            Card("7H"),
            Card("8H"),
            Card("9H"),
            Card("TH"),
            Card("JH"),
            Card("QH"),
            Card("KH"),
            Card("AH")
        ]

        self.plz_rebuild_players = True

        self.stat['expose_ah_mode'] = False
        self.stat['shoot_moon_mode'] = True
Ejemplo n.º 4
0
    def __init__(self, name, is_debug=False):
        super(RandomBot, self).__init__(name)

        self.htapi = Htapi(is_debug=is_debug)

        self.stat = {}