Ejemplo n.º 1
0
    def whisper(self):
        """
        秘密会話
        攻撃したい先を言って、一致しなかったら相手に合わせる

        襲撃先選択
        1.最も占いらしいやつ
        2.昨日の護衛結果が失敗だったら最も狩人らしいやつ
        """
        self.whisper_turn += 1

        # 生存者の確認
        self.alive = []
        for i in range(self.player_size):
            # 1-origin
            i += 1
            if self.base_info["statusMap"][str(i)] == "ALIVE":
                self.alive.append(str(i))

        if self.base_info["day"] == 0:
            if self.whisper_turn == 1:
                return cb.comingout(self.base_info["agentIdx"], "VILLAGER")
            else:
                return cb.over()
        # 候補者セット
        #cand = set(self.alive)-{str(int(self.base_info["agentIdx"]))}
        cand = self.rfestimator.decide_action("attack")
        print(set([self.base_info["agentIdx"]]),
              self.rfestimator.rec.game_info["dead"], self.wolfs)
        cand = cand - set([
            self.base_info["agentIdx"]
        ]) - self.rfestimator.rec.game_info["dead"] - self.wolfs
        # 襲撃先の吟味
        role = "SEER"
        if self.attack_success:
            self.todays_vote = int(self.predictor.role_est("SEER", cand))
            if self.whisper_turn == 1 and self.base_info["day"] < 3:
                return cb.estimate(self.todays_vote, role)
            if self.whisper_turn == 2:
                return cb.attack(self.todays_vote)
        else:
            # 昨日失敗してたら狩人がまだ生きてるということなので
            role = "BODYGUARD"
            self.todays_vote = int(self.predictor.role_est("BODYGUARD", cand))
            if self.whisper_turn == 1 and self.base_info["day"] < 3:
                return cb.estimate(self.todays_vote, role)
            if self.whisper_turn == 2:
                return cb.attack(self.todays_vote)

        return cb.over()
Ejemplo n.º 2
0
 def whisper(self):
     print("Executing whisper...")
     if self.current_target != None:
         selected = self.current_target
         print("Whispering request against current target: " +
               str(selected))
     else:
         selected = randomPlayerId(self.base_info)
         print("Whispering request against random agent: " + str(selected))
     return cb.request(cb.attack(selected))
Ejemplo n.º 3
0
    def whisper(self):
        #print("Whispering: ")
        for agent, val in self.player_map.items():
            if (self.player_map[agent]["dangerous_agent"] == True) and (self.dayTarget != int(agent)) and (agent not in self.base_info["roleMap"].keys()):
                self.nightTarget = int(agent)
                break

        if self.nightTarget == None:
            ids = []
            for key,value in self.base_info["statusMap"].items():
        	       if value == "ALIVE" and int(key) != self.id:
        	              ids.append(int(key))

            self.nightTarget = random.choice(ids)

        return cb.request(cb.attack(self.nightTarget))
Ejemplo n.º 4
0
 def whisper(self):
     #print(self.day,"whisperchat")
     if self.whisper_count == 0:
         self.whisper_count += 1
         return cb.attack(self.atackaction)
     elif self.whisper_count == 1:
         self.whisper_count += 1
         if self.day == 0:
             return cb.comingout(self.index, "WEREWOLF")
         else:
             return cb.skip()
     elif self.whisper_count == 2:
         self.whisper_count += 1
         if self.lastatack == None:
             return cb.over()
         else:
             return 'ATTACKED Agent[' + "{0:02d}".format(
                 self.lastatack) + ']'
     return cb.skip()
Ejemplo n.º 5
0
    def whisper(self):
        self.whisper_turn += 1
        """
        一番最初に霊能COをすることを伝える
        attack_voteで襲撃の投票をする先を宣言する
        """

        if self.role_decision == 0:
            # 0 日目 1 ターン目に "SEER" を宣言する
            if self.base_info["day"] == 0:
                if self.whisper_turn == 1:
                    return cb.comingout(self.base_info['agentIdx'], 'SEER')
                if self.whisper_turn == 2:
                    #1 ターン目に whisper の中で仲間の人狼が SEER CO をしていた場合
                    if len(self.W_COs) >= 2 or len(self.W_COm) >= 1:
                        self.stealth = 1
                        return cb.comingout(self.base_info['agentIdx'],
                                            'VILLAGER')
                    else:
                        return cb.skip()
                if self.whisper_turn >= 3:
                    return cb.skip()
                #return cb.over()
                return cb.skip()

        if self.role_decision == 1:
            # 0 日目 1 ターン目に ステルス挙動 を宣言する
            if self.base_info["day"] == 0:
                if self.whisper_turn == 1:
                    return cb.comingout(self.base_info['agentIdx'], 'VILLAGER')
                if self.whisper_turn >= 2:
                    return cb.skip()
                #return cb.over()
                return cb.skip()

        if self.role_decision == 2:
            # 0 日目 1 ターン目に "MEDIUM" を宣言する
            if self.base_info["day"] == 0:
                if self.whisper_turn == 1:
                    return cb.comingout(self.base_info['agentIdx'], 'MEDIUM')
                if self.whisper_turn == 2:
                    #1 ターン目に whisper の中で仲間の人狼が MEDIUM CO をしていた場合
                    if len(self.W_COm) >= 2 or len(self.W_COs) >= 1:
                        self.stealth = 1
                        return cb.comingout(self.base_info['agentIdx'],
                                            'VILLAGER')
                if self.whisper_turn >= 3:
                    return cb.skip()
                #return cb.over()
                return cb.skip()

        # 1 日目以降, 1 ターン目に "ATTACK" する対象を宣言する
        if self.base_info["day"] >= 1:
            if self.whisper_turn == 1:
                return cb.attack(self.attack())
            else:
                #return cb.over()
                return cb.skip()

        #return cb.over()
        return cb.skip()
Ejemplo n.º 6
0
 def whisper(self):
     #print(getTimeStamp()+" inside Whisper")
     selected = randomPlayerId(self.base_info)
     #print("Selected ID for whisper: "+str(selected))
     return cb.attack(selected)