Esempio 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()
Esempio n. 2
0
    def talk(self):
        self.talk_turn += 1
        #comingout
        if self.base_info["myRole"] == "SEER" and self.comingout == "":
            self.comingout = "SEER"
            return cb.comingout(self.base_info["agentIdx"], self.comingout)
        elif self.base_info["myRole"] == "POSSESSED" and self.comingout == "":
            self.comingout = "SEER"
            return cb.comingout(self.base_info["agentIdx"], self.comingout)

        #report
        if self.base_info["myRole"] == "SEER" and self.not_reported:
            self.not_reported = False
            return self.myresult

        elif self.base_info["myRole"] == "POSSESSED" and self.not_reported:
            self.not_reported = False
            return self.myresult

        #declare vote
        if self.vote_declare != self.vote():
            self.vote_declare = self.vote()
            return cb.vote(self.vote_declare)

        #skip
        if self.talk_turn <= 10:
            return cb.skip()

        return cb.over()
Esempio n. 3
0
 def whisper(self):
     # return self.behavior.whisper()
     try:
         return self.behavior.whisper()  # 人格ごとに呼び出す
     except Exception:
         print("ERROR:mainwhisper")
         return cb.over()  # エラーが起きたらoverを返す
Esempio n. 4
0
 def whisper(self):
     #return self.behavior.whisper()
     try:
         return self.behavior.whisper()
     except Exception:
         print("ERROR!!!!!!!!!!something wrong and returned tekito")
         return cb.over()
Esempio n. 5
0
    def talk(self):
        self.talk_turn += 1

        # 1.comingout anyway
        if self.base_info['myRole'] == 'SEER' and self.comingout == '':
            self.comingout = 'SEER'
            return cb.comingout(self.base_info['agentIdx'], self.comingout)
        elif self.base_info['myRole'] == 'POSSESSED' and self.comingout == '':
            self.comingout = 'SEER'
            return cb.comingout(self.base_info['agentIdx'], self.comingout)

        # 2.report
        if self.base_info['myRole'] == 'SEER' and self.not_reported:
            self.not_reported = False
            return self.myresult
        elif self.base_info['myRole'] == 'POSSESSED' and self.not_reported:
            self.not_reported = False
            # FAKE DIVINE
            # highest prob ww in alive agents
            idx = self.highest(1)
            self.myresult = 'DIVINED Agent[' + \
                "{0:02d}".format(idx) + '] ' + 'HUMAN'
            return self.myresult

        # 3.declare vote if not yet
        if self.vote_declare != self.vote():
            self.vote_declare = self.vote()
            return cb.vote(self.vote_declare)

        # 4. skip
        if self.talk_turn <= 10:
            return cb.skip()

        return cb.over()
Esempio n. 6
0
 def whisper(self):
     self.whisper_turn += 1
     # whisperの最初の会話で食べる人宣言
     if self.whisper_turn == 1:
         # 最も人間らしい人を食べると宣言
         return str(self.__n_th_suspicious(self.alive-1))
     return cb.over()
 def talk(self):
     self.talk_turn += 1
     
     # 1.CO
     if self.base_info['myRole'] == 'MEDIUM' and self.comingout == '' \
         and ( self.seer_co_num >= 2 or self.comingoutday <= self.base_info['day']):
         self.comingout = 'MEDIUM'
         return cb.comingout(self.base_info['agentIdx'], self.comingout)
     """
     elif self.base_info['myRole'] == 'SEER' and self.comingout == '':
         self.comingout = 'SEER'
         return cb.comingout(self.base_info['agentIdx'], self.comingout)
     elif self.base_info['myRole'] == 'POSSESSED' and self.comingout == '':
         self.comingout = 'SEER'
         return cb.comingout(self.base_info['agentIdx'], self.comingout)
     """
     
     # 2. 結果報告
     if(self.not_reported):
         if(self.base_info['myRole'] == 'MEDIUM' and self.result_roll != []):
             ident = self.result_roll.pop()
             return cb.comingout(ident[0], ident[1])
     
     # 3.vote宣言
     if(self.vote_declare != self.vote()):
         self.vote_declare = self.vote()
         print(self.vote_declare)
         return cb.vote(self.vote_declare)
     
     # 4.発言回数残ってたらskip
     if self.talk_turn <= 10:
         return cb.skip()
     
     return cb.over()
Esempio n. 8
0
 def talk(self):  # 発話内容をサーバーに渡すメソッド
     # return self.behavior.talk()
     try:
         return self.behavior.talk()  # 人格ごとに呼び出す
     except Exception:
         print("ERROR:maintalk")
         print(self.base_info["myRole"])
         return cb.over()  # エラーが起きたらoverを返す
Esempio n. 9
0
    def talk(self):  # 発話内容をサーバーに送るメソッド
        if self.base_info["myRole"] == 'VILLAGER':
            self.talk_turn += 1
        # print("villagerのtalk_turn", self.base_info["day"], self.talk_turn)

        if self.talk_turn < 10:
            return cb.vote(self.vote())
            # return cb.skip()
        return cb.over()
Esempio n. 10
0
    def talk(self):
        self.talk_turn += 1

        # vote宣言
        if (self.vote_declare != self.vote()):
            self.vote_declare = self.vote()
            print(self.vote_declare)
            return cb.vote(self.vote_declare)

        # 発言回数残ってたらskip
        if self.talk_turn <= 10:
            return cb.skip()

        return cb.over()
Esempio n. 11
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()
Esempio n. 12
0
    def talk(self):
        self.talk_turn += 1
        if self.game_setting['playerNum'] == 15:
            if self.base_info['myRole'] == 'SEER' and self.comingout == '':
                #self.comingout = 'SEER'
                #return cb.comingout(self.base_info['agentIdx'], self.comingout)
                pass
            elif self.base_info['myRole'] == 'MEDIUM' and self.comingout == '':
                self.comingout = 'MEDIUM'
                return cb.comingout(self.base_info['agentIdx'], self.comingout)
            elif self.base_info[
                    'myRole'] == 'POSSESSED' and self.comingout == '':
                #self.comingout = 'SEER'
                pass
                #return cb.comingout(self.base_info['agentIdx'], self.comingout)

            elif self.base_info[
                    'myRole'] == 'WEREWOLF' and self.comingout == '':
                self.comingout = 'SEER'
                alive_list = []
                for i in range(1, self.game_setting['playerNum'] + 1):
                    if i == self.base_info['agentIdx']:
                        pass
                    elif self.base_info['statusMap'][str(i)] == 'ALIVE':
                        alive_list.append(i)
                return cb.comingout(random.choice(alive_list), self.comingout)
        else:
            if self.base_info['myRole'] == 'SEER' and self.comingout == '':
                #self.comingout = 'SEER'
                pass
                return cb.comingout(self.base_info['agentIdx'], self.comingout)
            elif self.base_info['myRole'] == 'MEDIUM' and self.comingout == '':
                self.comingout = 'MEDIUM'
                return cb.comingout(self.base_info['agentIdx'], self.comingout)
            elif self.base_info[
                    'myRole'] == 'POSSESSED' and self.comingout == '':
                #self.comingout = 'SEER'
                #return cb.comingout(self.base_info['agentIdx'], self.comingout)
                pass
            elif self.talk_turn <= 2:
                return cb.skip()

        return cb.over()
Esempio n. 13
0
    def talk(self):
        """
        村人は原則カミングアウトしない。
        1.その日までの結果を基に一番怪しいやつにVote宣言をする
        2.カミングアウトなどで一番怪しいやつが変化したら改めてvote宣言をする
        3.最後にVote宣言した相手に実際の投票をする
        """

        #各日4ターン目で投票先宣言
        if self.talk_turn == 5:
            cand = self.rfestimator.decide_action("vote")
            #print("TURN",self.talk_turn)
            print(cand)
            return util.list2protocol(cand, "VOTE OR")

        # 何もなければOver
        if self.talk_turn < 5:
            return cb.skip()
        return cb.over()
Esempio n. 14
0
    def talk(self):
        self.talk_turn += 1

        # 1.comingout anyway
        if self.base_info['myRole'] == 'SEER' and self.comingout == '':
            self.comingout = 'SEER'
            return cb.comingout(self.base_info['agentIdx'], self.comingout)
        elif self.base_info['myRole'] == 'POSSESSED' and self.comingout == '':
            self.comingout = 'SEER'
            return cb.comingout(self.base_info['agentIdx'], self.comingout)

        # 2.report
        if self.base_info['myRole'] == 'SEER' and self.not_reported:
            self.not_reported = False
            return self.myresult
        elif self.base_info['myRole'] == 'POSSESSED' and self.not_reported:
            self.not_reported = False
            # FAKE DIVINE
            # highest prob ww in alive agents
            p = -1
            idx = 1
            p0_mat = self.predicter_5.ret_pred_wx(2)
            for i in range(1, 6):
                p0 = p0_mat[i-1, 1]
                if self.base_info['statusMap'][str(i)] == 'ALIVE' and p0 > p:
                    p = p0
                    idx = i
            self.myresult = 'DIVINED Agent[' + \
                "{0:02d}".format(idx) + '] ' + 'HUMAN'
            return self.myresult

        # 3.declare vote if not yet
        if self.vote_declare != self.vote():
            self.vote_declare = self.vote()
            return cb.vote(self.vote_declare)

        # 4. skip
        if self.talk_turn <= 10:
            return cb.skip()

        return cb.over()
Esempio n. 15
0
    def talk(self):
        # 時間計測
        start = time.time()
        self.talk_turn += 1
        #乱数
        tSkip_num = random.randint(1, 10)

        # 1日目(SEER or POSSESSEDならCOしみてる)
        if self.base_info['day'] == 1 and self.talk_turn == 1 and not(self.co):
            if self.base_info['myRole'] == 'SEER' or self.base_info['myRole'] == 'POSSESSED':
                if time.time()-start >= 0.1:
                    print("over talk time")
                # print("SEERでカミングアウトして見た :" + self.base_info['myRole'])
                self.co = True
                return cb.comingout(self.base_info['agentIdx'], 'SEER')

        # 役持ち村人の時,偽物がCOしてたら自分も名乗り出る
        if not(self.co) and self.role_villager and len(self.comingout[self.base_info['myRole']]) >= 1:
            # print("偽物が名乗り出たのでCOしました")
            self.co = True
            return cb.comingout(self.base_info['agentIdx'], self.base_info['myRole'])
            
        
        # 数ターン様子を見てみる
        if self.talk_turn < tSkip_num:
            if time.time()-start >= 0.1:
                print("over talk time")
            return cb.skip()

        # 占い結果が出た時に伝える(skipを何回かしてみる)
        if self.base_info['myRole'] == 'SEER' and self.seer_flag:
            self.seer_flag = False
            # print("占い結果報告")
            # print('Agent' + str(self.seer_divined_id) + 'が' + self.seer_divined_role)
            # print("----------------------------------")
            return cb.divined(self.seer_divined_id,self.seer_divined_role)
        
        if time.time()-start >= 0.1:
            print("over talk time")
        return cb.over()
    def whisper(self):

        if (self.base_info['day'] == 0):
            # 最初にwisperで何騙りするか決定
            choice_roll = random.choice(range(10))
            if (choice_roll < 3):
                self.comingout = 'SEER'
                return cb.comingout(self.base_info['agentIdx'], self.comingout)
            elif (choice_roll < 4):
                self.comingout = 'MEDIUM'
                return cb.comingout(self.base_info['agentIdx'], self.comingout)
            else:
                self.comingout = 'VILLAGER'
                return cb.comingout(self.base_info['agentIdx'], self.comingout)

        if (self.base_info['day'] == 0 and self.result_wisper != []):
            for i in self.result_wisper:
                if (i[1] == 'WEREWOLF'):
                    self.comingout = 'VILLAGER'
                    return cb.comingout(self.base_info['agentIdx'],
                                        self.comingout)

        return cb.over()
Esempio n. 17
0
 def whisper(self):
     return cb.over()
Esempio n. 18
0
 def whisper(self):
     # not whispe
     return cb.over()
Esempio n. 19
0
 def talk(self):
     self.talk_turn += 1
     
     # 1.CO
     if(self.base_info['myRole'] == 'MEDIUM' and self.comingout == '' \
         and ( self.seer_co_num >= 2 or self.comingoutday <= self.base_info['day'])):
         self.comingout = 'MEDIUM'
         return cb.comingout(self.base_info['agentIdx'], self.comingout)
     elif(self.base_info['myRole'] == 'SEER' and self.comingout == ''):
         self.comingout = 'SEER'
         return cb.comingout(self.base_info['agentIdx'], self.comingout)
     elif(self.base_info['myRole'] == 'POSSESS' and self.comingout == '' \
          and (self.possess_justco == 1 or self.seer_co_num >= 1)):
         self.comingout = 'SEER'
         return cb.comingout(self.base_info['agentIdx'], self.comingout)
     
     # 2. 結果報告
     if(self.not_reported):
         if(self.base_info['myRole'] == 'MEDIUM' and self.result_roll != []):
             ident = self.result_roll.pop()
             return cb.identified(ident[0], ident[1])
         elif(self.base_info['myRole'] == 'SEER' and self.result_roll != []):
             divination = self.result_roll.pop()
             return cb.divination(divination[0], divination[1])
     if(self.base_info['myRole'] == 'POSSESS' and self.comingout != ''):
         # self.possess_justcoこれ使ってるけどco関係なくてただの欄数が欲しいだけ
         # idx = chainer_predict.estimate_wolf(self.info, self.base_info)
         idx = random.shuffle(range(len(self.base_info['agentIdx']))+1)
         if(self.possess_justco == 1 and idx != -1):
             possess_div = []
             for i in range(1,len(self.base_info['statusMap'])+1):
                 if((i not in idx) and (i not in self.voted_list)):
                     possess_div.append(i)
             div = random.choice(possess_div)
             self.voted_list.append(div)
             species = random.choice(['HUMAN','WEREWOLF'])
             if(species == 'WEREWOLF'):
                 self.possess_wolf.append(div)
             return cb.divination(div, species)
         else:
             not_vote_list = []
             for i in idx:
                 if(i not in self.voted_list):
                     not_vote_list.append(i)
             voted = random.choice(not_vote_list)
             self.voted_list.append(voted)
             return cb.divination(voted, 'HUMAN')
             
     
     # 3.vote宣言
     # 狂人は黒判定した奴に投票
     if(self.base_info['myRole'] == 'POSSESS' and self.possess_wolf != []):
         return cb.vote(random.choice(self.possess_wolf))
     elif(self.vote_declare != self.vote()):
         self.vote_declare = self.vote()
         print(self.vote_declare)
         return cb.vote(self.vote_declare)
     
     # 4.発言回数残ってたらskip
     if self.talk_turn <= 10:
         return cb.skip()
     
     return cb.over()
Esempio n. 20
0
    def talk(self):
        if self.game_setting['playerNum'] == 15:

            self.talk_turn += 1

            # 1.comingout anyway
            if self.base_info['myRole'] == 'SEER' and self.comingout == '':
                self.comingout = 'SEER'
                return cb.comingout(self.base_info['agentIdx'], self.comingout)
            elif self.base_info['myRole'] == 'MEDIUM' and self.comingout == '':
                self.comingout = 'MEDIUM'
                return cb.comingout(self.base_info['agentIdx'], self.comingout)

            elif self.base_info[
                    'myRole'] == 'POSSESSED' and self.comingout == '':
                if self.predicter_15.num_seer() < 2 and rand() < 0.5:
                    self.comingout = 'SEER'
                    return cb.comingout(self.base_info['agentIdx'],
                                        self.comingout)

            elif self.base_info[
                    'myRole'] == 'WEREWOLF' and self.comingout == '' and self.base_info[
                        "day"] < 4:
                if self.predicter_15.num_seer() < 2 and rand(
                ) < 0.1 and self.base_info["day"] == 2:
                    self.comingout = 'SEER'
                    return cb.comingout(self.base_info['agentIdx'],
                                        self.comingout)
                elif self.predicter_15.num_seer(
                ) > 1 and self.predicter_15.num_medium() < 2 and rand() < 0.1:
                    self.comingout = 'MEDIUM'
                    return cb.comingout(self.base_info['agentIdx'],
                                        self.comingout)
            # 2.report
            if self.base_info['myRole'] == 'SEER' and self.not_reported:
                self.not_reported = False
                return self.myresult
            elif self.base_info['myRole'] == 'MEDIUM' and self.not_reported:
                self.not_reported = False
                return self.myresult
            elif self.base_info['myRole'] == 'POSSESSED' and self.not_reported:
                self.not_reported = False
                # FAKE
                if self.comingout == 'SEER':
                    return self.possessed_seer_result()
                elif self.comingout == 'MEDIUM':
                    return self.fake_medium_result()

            elif self.base_info['myRole'] == 'WEREWOLF' and self.not_reported:
                self.not_reported = False
                # FAKE
                if self.comingout == 'SEER':
                    return self.werewolf_seer_result()
                elif self.comingout == 'MEDIUM':
                    return self.fake_medium_result()
            # 3.declare vote if not yet
            if self.vote_declare != self.vote():
                self.vote_declare = self.vote()
                return cb.vote(self.vote_declare)

            # 4. skip
            if self.talk_turn <= 10:
                return cb.skip()

            return cb.over()
        else:
            self.talk_turn += 1

            # 1.comingout anyway
            if self.base_info['myRole'] == 'SEER' and self.comingout == '':
                self.comingout = 'SEER'
                return cb.comingout(self.base_info['agentIdx'], self.comingout)
            elif self.base_info['myRole'] == 'MEDIUM' and self.comingout == '':
                self.comingout = 'MEDIUM'
                return cb.comingout(self.base_info['agentIdx'], self.comingout)
            elif self.base_info[
                    'myRole'] == 'POSSESSED' and self.comingout == '':
                self.comingout = 'WEREWOLF'
                return cb.comingout(self.base_info['agentIdx'], self.comingout)

            # 2.report
            if self.base_info['myRole'] == 'SEER' and self.not_reported:
                self.not_reported = False
                return self.myresult
            elif self.base_info['myRole'] == 'MEDIUM' and self.not_reported:
                self.not_reported = False
                return self.myresult
            elif self.base_info['myRole'] == 'POSSESSED' and self.not_reported:
                self.not_reported = False
                # FAKE DIVINE
                # highest prob ww in alive agents

                #return self.fake_seer()

            # 3.declare vote if not yet
            if self.vote_declare != self.vote():
                self.vote_declare = self.vote()
                return cb.vote(self.vote_declare)

            # 4. skip
            if self.talk_turn <= 10:
                return cb.skip()

            return cb.over()
Esempio n. 21
0
 def talk(self):
     logging.debug("# TALK")
     return cb.over()
Esempio n. 22
0
 def whisper(self):
     try:
         return self.role.whisper()
     except Exception:
         print(self.base_info["myRole"], "error whisper")
         return cb.over()
Esempio n. 23
0
 def whisper(self):
     logging.debug("# WHISPER")
     return cb.over()
Esempio n. 24
0
 def whisper(self):
     """
     村人はwhisperを呼ばれることがない
     """
     return cb.over()
Esempio n. 25
0
    def talk(self):

        if self.game_setting['playerNum'] == 15:

            self.talk_turn += 1

            # 1.comingout anyway
            if self.base_info['myRole'] == 'SEER' and self.comingout == '':
                self.comingout = 'SEER'
                return cb.comingout(self.base_info['agentIdx'], self.comingout)
            elif self.base_info['myRole'] == 'MEDIUM' and self.comingout == '':
                self.comingout = 'MEDIUM'
                return cb.comingout(self.base_info['agentIdx'], self.comingout)
            elif self.base_info[
                    'myRole'] == 'POSSESSED' and self.comingout == '':
                if np.random.rand() < 0.5:
                    self.comingout = 'SEER'
                    self.pretend_seer = True
                else:
                    self.comingout = 'MEDIUM'
                    self.pretend_medium = True
                return cb.comingout(self.base_info['agentIdx'], self.comingout)

            # 1.2 ww pretend seer
            elif self.base_info['myRole'] == 'WEREWOLF':
                if self.pretend_seer and self.base_info[
                        'day'] == 1 and self.talk_turn <= 1:
                    self.comingout = 'SEER'
                # 毎日、毎ターン霊媒師だと訴え続ける
                elif self.pretend_medium:
                    self.comingout = 'MEDIUM'
                return cb.comingout(self.base_info['agentIdx'], self.comingout)

            # 1.3 pp
            # if self.base_info['statusMap'].values().count('ALIVE') == 4:
            #     if self.base_info['myRole']

            # 2.report
            if self.base_info['myRole'] == 'SEER' and self.not_reported:
                self.not_reported = False
                return self.myresult
            elif self.base_info['myRole'] == 'MEDIUM' and self.not_reported:
                self.not_reported = False
                return self.myresult
            elif self.pretend_seer and self.not_reported:
                self.not_reported = False
                # FAKE DIVINE
                # highest prob ww in alive agents
                p = -1
                idx = 1
                p0_mat = self.predicter_15.ret_pred()
                for i in range(1, 16):
                    p0 = p0_mat[i - 1, 1]
                    if self.base_info['statusMap'][str(
                            i)] == 'ALIVE' and p0 > p:
                        p = p0
                        idx = i
                self.myresult = 'DIVINED Agent[' + "{0:02d}".format(
                    idx) + '] ' + 'HUMAN'
                return self.myresult

            # 3.declare vote if not yet
            if self.vote < 0.3:
                return cb.skip()
            if self.vote_declare != self.vote():
                if self.estimated:
                    self.vote_declare = self.vote()
                    return cb.vote(self.vote_declare)
                else:
                    self.estimated = True
                    if self.base_info['myRole'] not in [
                            'WEREWOLF', 'POSSESSED'
                    ]:
                        return cb.estimate(self.vote(), 'WEREWOLF')
                    else:
                        tmp_myRole, self.base_info['myRole'] = self.base_info[
                            'myRole'], 'VILLAGER'
                        fake_vote = self.vote()
                        self.base_info['myRole'] = tmp_myRole
                        return cb.estimate(fake_vote, 'WEREWOLF')

            # 4. skip
            if self.talk_turn <= 10:
                return cb.skip()

            return cb.over()
        else:
            self.talk_turn += 1

            # 1.comingout anyway
            if self.base_info['myRole'] == 'SEER' and self.comingout == '':
                self.comingout = 'SEER'
                return cb.comingout(self.base_info['agentIdx'], self.comingout)
            # elif self.base_info['myRole'] == 'MEDIUM' and self.comingout == '':
            #     self.comingout = 'MEDIUM'
            # return cb.comingout(self.base_info['agentIdx'], self.comingout)
            elif self.base_info[
                    'myRole'] == 'POSSESSED' and self.comingout == '':
                self.comingout = 'SEER'
                return cb.comingout(self.base_info['agentIdx'], self.comingout)

            # 1.2 PP sonoda added
            if self.base_info["day"] == 2 and self.base_info[
                    'myRole'] == 'POSSESSED':
                self.comingout = 'POSSESSED'
                return cb.comingout(self.base_info['agentIdx'], self.comingout)

            # 1.3 PP-Block
            if self.base_info['day'] == 2 and self.base_info[
                    'myRole'] == 'VILLAGER' and self.try_pp_block:
                self.comingout = 'WEREWOLF'
                return cb.comingout(self.base_info['agentIdx'], self.comingout)

            # 2.report
            if self.base_info['myRole'] == 'SEER' and self.not_reported:
                self.not_reported = False
                return self.myresult
            elif self.base_info['myRole'] == 'MEDIUM' and self.not_reported:
                self.not_reported = False
                return self.myresult
            elif self.base_info['myRole'] == 'POSSESSED' and self.not_reported:
                self.not_reported = False
                # FAKE DIVINE
                # highest prob ww in alive agents
                p = -1
                idx = 1
                p0_mat = self.predicter_5.ret_pred_wx(2)
                for i in range(1, 6):
                    p0 = p0_mat[i - 1, 1]
                    if self.base_info['statusMap'][str(
                            i)] == 'ALIVE' and p0 > p:
                        p = p0
                        idx = i
                self.myresult = 'DIVINED Agent[' + "{0:02d}".format(
                    idx) + '] ' + 'HUMAN'
                return self.myresult

            # 3.declare vote if not yet
            if self.vote_declare != self.vote():
                self.vote_declare = self.vote()
                return cb.vote(self.vote_declare)

            # 4. skip
            if self.talk_turn <= 10:
                return cb.skip()

            return cb.over()
Esempio n. 26
0
    def talk(self):
        #print("talk")
        #print(self.start,time.time())
        #if (time.time() - self.start) >= 0.8:
        #print("time out")
        #return cb.over()
        if not self.islearn:
            return cb.over()

            #print(self.actionLog)
        if self.action_flag:
            if self.role == "VILLAGER":
                if self.talk_count == 0:
                    self.talk_count += 1
                    return cb.estimate(self.action[0], "WEREWOLF")
                    #return 'ESTIMATET Agent[' + "{0:02d}".format(self.action[0]) + '] ' + "WEREWOLF"
                elif self.talk_count == 1:
                    self.talk_count += 1
                    return cb.vote(self.action[0])
                    #return 'VOTE Agent[' + "{0:02d}".format(self.action[0]) + ']'
                elif self.talk_count == 2:
                    self.talk_count += 1
                    if self.day <= 3:
                        return cb.skip()
                    return cb.comingout(self.action[0], "WEREWOLF")
                    #return 'COMMINGOUT Agent[' + "{0:02d}".format(self.action[0]) + '] ' + "WEREWOLF"
                elif self.talk_count == 3:
                    self.talk_count += 1
                    if len(self.action) >= 2:
                        return cb.estimate(self.action[1], "WEREWOLF")
                    #return 'ESTIMATET Agent[' + "{0:02d}".format(self.action[1]) + '] ' + "WEREWOLF"
                elif self.talk_count == 4:
                    self.talk_count += 1
                    if len(self.action) >= 3:
                        return cb.comingout(self.action[-1], "VILLAGER")
                    #return 'COMMINGOUT Agent[' + "{0:02d}".format(self.action[2]) + '] ' + "HUMAN"
                elif self.talk_count == 5:
                    self.talk_count += 1
                    if len(self.action) >= 4:
                        return cb.estimate(self.action[-2], "VILLAGER")
                    #return 'ESTIMATET Agent[' + "{0:02d}".format(self.action[3]) + '] ' + "HUMAN"
                elif self.talk_count == 6:
                    self.talk_count += 1
                    self.action_flag = False
                    return cb.over()

            elif self.role == "WEREWOLF":
                if self.talk_count == 0:
                    self.talk_count += 1
                    if len(self.action) >= 4:
                        return cb.estimate(self.action[-1], "WEREWOLF")
                    #return 'ESTIMATET Agent[' + "{0:02d}".format(self.action[0]) + '] ' + "WEREWOLF"
                elif self.talk_count == 1:
                    self.talk_count += 1
                    if len(self.action) >= 4:
                        return cb.vote(self.action[-1])
                    #return 'VOTE Agent[' + "{0:02d}".format(self.action[0]) + ']'
                elif self.talk_count == 2:
                    self.talk_count += 1
                    if self.day <= 3:
                        return cb.skip()
                    if len(self.action) >= 4:
                        return cb.comingout(self.action[-1], "WEREWOLF")
                    #return 'COMMINGOUT Agent[' + "{0:02d}".format(self.action[0]) + '] ' + "WEREWOLF"
                elif self.talk_count == 3:
                    self.talk_count += 1
                    if len(self.action) >= 3:
                        return cb.estimate(self.action[-2], "WEREWOLF")
                    #return 'ESTIMATET Agent[' + "{0:02d}".format(self.action[1]) + '] ' + "WEREWOLF"
                elif self.talk_count == 4:
                    self.talk_count += 1
                    if self.day <= 3:
                        return cb.skip()
                    return cb.comingout(self.action[1], "VILLAGER")
                    #return 'COMMINGOUT Agent[' + "{0:02d}".format(self.action[2]) + '] ' + "HUMAN"
                elif self.talk_count == 5:
                    self.talk_count += 1
                    if len(self.action) >= 3:
                        return cb.estimate(self.action[2], "VILLAGER")
                    #return 'ESTIMATET Agent[' + "{0:02d}".format(self.action[3]) + '] ' + "HUMAN"
                elif self.talk_count == 6:
                    self.talk_count += 1
                    self.action_flag = False
                    return cb.over()
            else:
                cb.over()
        return cb.skip()
Esempio n. 27
0
 def talk(self):
     return cb.over()