Esempio n. 1
0
    def talk(self):

        self.isFollow = False

        # COTrigerがTrueならCO
        if (self.SeerCOTrigger() and not self.isSeerCO):
            self.isSeerCO = True
            return ttf.comingout(self.agentIdx, 'SEER')

        # COしたら言っていない結果がなくなるまでdivined
        if (self.isSeerCO and len(self.myDivine) > 0):
            target = self.myDivine[0]
            result = self.divined[target]
            self.myDivine.pop(0)
            if (target != self.agentIdx):
                return ttf.divined(target, result)

        # 扇動受けるメソッド
        requests = self.myData.getRequestTodayMe()
        if requests != None:
            x = random.randint(0, 3)
            y = random.randint(0, 5)
            if len(requests) > 0 and x > y:
                for request in requests:
                    if request.getContent() in ['ESTIMATE']:
                        talk = self.Estimate(request.getTarget2())
                        if (talk != None): return talk
                    if request.getContent() in ['VOTE']:
                        target = request.getTarget2()
                        self.willvote = target
                        self.isFollow = True
                        return ttf.vote(target)

        #VOTE宣言(明確な偽、自分への黒出し、最黒)
        target = self.MyTarget()
        if (self.willvote != target):
            self.willvote = target
            return ttf.vote(self.willvote)

        #ESTIMATE宣言
        if (self.myData.getTurn() < 10):
            talk = self.Estimate(self.willvote)
            if (talk != None): return talk

        #REQUEST宣言
        if (self.isRequest or self.isRequestAll):
            if (not self.isSeerCO):  #占いCOしていない場合
                fakeSeers = self.alivefakeSeers + self.alivefakeMediums
                talk = self.Request(fakeSeers)
                if (talk != None): return talk

        return ttf.over()
Esempio n. 2
0
    def talk(self):

        #COTrigerがTrueならCO
        if (self.COTrigger()):
            self.isCO = True
            return ttf.comingout(self.agentIdx, 'SEER')

        #COしたら言っていない結果がなくなるまでdivined
        if (self.isCO and len(self.willSay) > 0):
            target = self.willSay[0]['target']
            result = self.willSay[0]['result']
            self.willSay.pop(0)
            return ttf.divined(target, result)

        #VOTE宣言(明確な偽、自分への黒出し、最黒)
        target = self.MyTarget()
        if (self.willvote != target):
            self.willvote = target
            return ttf.vote(self.willvote)

        #ESTIMATE宣言
        if (self.myData.getTurn() < 10):
            talk = self.Estimate(self.willvote)
            if (talk != None): return talk

        return ttf.over()
Esempio n. 3
0
    def talk(self):

        #COTrigerがTrueならCO
        if self.COTrigger():
            self.isCO = True
            return ttf.comingout(self.agentIdx,'SEER')

        #2日目PPCO
        if self.myData.getToday() == 2 and self.PosCOTrigger():
            self.isPosCO = True
            return ttf.comingout(self.agentIdx,'POSSESSED')

        #COしたらdivined
        if(len(self.result) > 0 and not self.isPosCO):
            rand_x = random.randrange(10)
            threshhold = int(20 / math.pi * math.atan(self.myData.getTurn() - 1))
            rand_y = random.randrange(threshhold if threshhold > 1 else 1)
            if (self.isCO and rand_x <= rand_y):
                target = list(self.result.keys())[0]
                result = self.result[target]
                del self.result[target]
                return ttf.divined(target, result)

        #VOTE宣言
        if(self.willvote != self.MyTarget()):
            self.willvote = self.MyTarget()
            return ttf.vote(self.willvote)

        #ESTIMATE宣言
        if(self.myData.getTurn() < 10):
            talk = self.Estimate(self.willvote)
            if(talk != None):   return talk

        return ttf.over()
Esempio n. 4
0
    def talk(self):

        self.isFollow = False

        # 扇動受けるメソッド
        requests = self.myData.getRequestTodayMe()
        if requests != None:
            wolf = self.myData.getMaxLikelyWolfAll()
            x = random.randint(0,3)
            y = random.randint(0,5)
            if len(requests) > 0 and x > y:
                for request in requests:
                    if not request.getAgent() in self.flatten([self.fakeMediums, self.fakeSeers, self.myfakeSeers]) or request.getAgent() != wolf:
                        if request.getContent() in ['ESTIMATE']:
                            talk = self.Estimate(request.getTarget2())
                            if (talk != None):   return talk
                        if request.getContent() in ['VOTE']:
                            target = request.getTarget2()
                            self.willvote = target
                            self.isFollow = True
                            return ttf.vote(target)

        #VOTE宣言(明確な偽、自分への黒出し、最黒)
        target = self.MyTarget()
        if(self.willvote != target):
            self.willvote = target
            return ttf.vote(self.willvote)

        #ESTIMATE宣言
        if(self.myData.getTurn() < 10):
            talk = self.Estimate(self.willvote)
            if(talk != None):   return talk

        #REQUEST宣言
        if(self.isRequest or self.isRequestAll):
            fakeSeers   = self.alivefakeSeers + self.alivefakeMediums
            talk = self.Request(fakeSeers)
            if(talk != None):   return talk

        #BGCO
        if self.isBlacked and not self.isCall:
            self.isCall = True
            return ttf.comingout(self.agentIdx,'BODYGUARD')

        return ttf.over()
Esempio n. 5
0
    def talk(self):

        if (self.COTrigger()):
            if (self.isCO):
                return ttf.comingout(self.agentIdx, 'SEER')
            else:
                return ttf.comingout(self.agentIdx, 'VILLAGER')

        #2日目:狂人占い師確定でWWCO
        if (self.myData.getToday() > 1 and self.WWCOTrigger()):
            return ttf.comingout(self.agentIdx, 'WEREWOLF')

        #VOTE宣言
        if (self.willvote != self.MyTarget()):
            self.willvote = self.MyTarget()
            return ttf.vote(self.willvote)

        #ESTIMATE宣言
        if (self.myData.getTurn() < 10):
            talk = self.Estimate(self.willvote)
            if (talk != None): return talk

        return ttf.over()
Esempio n. 6
0
    def talk(self):

        if self.isSeerCO and self.doDivine:
            if self.myData.getToday() > 1:
                execute = self.myData.getExecutedAgent()
                if execute in self.divineList: self.divineList.remove(execute)
            target, result = self.PossessedDivine()
            self.myDivine.append(target)
            self.doDivine = False

        #2日目以降COの場合,Divineを規定回数するために
        if self.isSeerCO:
            if len(self.divined) < self.myData.getToday():
                target, result = self.PossessedDivine()
                self.myDivine.append(target)
        '''
        if self.myData.getToday() == 1 and self.doDivine:
            if self.myData.getTurn() == 1:
                execute = self.myData.getExecutedAgent()
                if (execute in self.divineList): self.divineList.remove(execute)
                target, result = self.PossessedDivine()
                self.myDivine.append(target)
                self.doDivine = False
        elif(self.myData.getToday() >=2 and self.doDivine):
            execute = self.myData.getExecutedAgent()
            if (execute in self.divineList): self.divineList.remove(execute)
            target, result = self.PossessedDivine()
            self.myDivine.append(target)
            self.doDivine = False
        '''

        #COTrigerがTrueならCO
        if (self.COTrigger() and not self.isSeerCO):
            self.isSeerCO = True
            return ttf.comingout(self.agentIdx, 'SEER')

        #PPTrigerがTrueなら確率で人狼・狂人CO
        if (self.PPTrigger() and not self.isBlackCO):
            self.isBlackCO = True
            x = random.randint(1, 2)
            if (x == 1):
                return ttf.comingout(self.agentIdx, 'WEREWOLF')
            else:
                return ttf.comingout(self.agentIdx, 'POSSESSED')

        #PPTriggerがTrueなら生き残り全員に黒出す
        if (self.PPTrigger() and len(self.aliveList) > 0):
            self.doPP = True
            target = self.aliveList[0]
            self.aliveList.pop(0)
            return ttf.divined(target, 'WEREWOLF')

        #COしたら言っていない結果がなくなるまでdivined
        if (self.isSeerCO and len(self.myDivine) > 0):
            target = self.myDivine[0]
            result = self.divined[target]
            self.myDivine.pop(0)
            return ttf.divined(target, result)

        #VOTE宣言(明確な偽、自分への黒出し、最黒)
        target = self.MyTarget()
        if (self.willvote != target):
            self.willvote = target
            return ttf.vote(self.willvote)

        #狼陣営と予測された人からのリクエスト受付
        requests = self.myData.getRequestTodayMe()
        if requests != None:
            wolf = self.myData.getMaxLikelyWolfAll()
            x = random.randint(0, 10)
            y = random.randint(0, 2)
            if len(requests) > 0 and x > y:
                for request in requests:
                    if (request.getAgent() in self.flatten([
                            self.fakeMediums, self.fakeSeers, self.fakeMedium,
                            self.fakeSeer, self.werewolves
                    ]) or request.getAgent()
                            == wolf):  #2重リストやとうまくいかないっぽいのでフラットにする
                        if request.getContent() in ['ESTIMATE']:
                            talk = self.Estimate(request.getTarget2())
                            if (talk != None): return talk
                        if request.getContent() in ['VOTE']:
                            target = request.getTarget2()
                            if (target != self.agentIdx):
                                self.willvote = target
                                self.isFollow = True
                                return ttf.vote(target)

        #ESTIMATE宣言
        if (self.myData.getTurn() < 10):
            talk = self.Estimate(self.willvote)
            if (talk != None): return talk
        '''
        #BGCO
        if(self.blacked and not self.isCall and not self.isSeerCO):
            self.isCall = True
            return ttf.comingout(self.agentIdx,'BODYGUARD')
        '''

        return ttf.over()
Esempio n. 7
0
    def talk(self):
        self.isFollow = False

        # GJ 報告
        # CO した状況下で,GJ できていれば GJ 成功報告と guard 対象を伝える
        # 確率変動いる?
        if self.isGJ and self.isCall and self.declare and self.myguard != None:
            self.declare = False
            return ttf.guarded(self.myguard)

        # 扇動受けるメソッド
        requests = self.myData.getRequestTodayMe()
        if requests != None:
            wolf = self.myData.getMaxLikelyWolfAll()
            x = random.randint(0,3)
            y = random.randint(0,5)
            if len(requests) > 0 and x > y:
                for request in requests:
                    if not request.getAgent() in self.flatten([self.fakeMediums, self.fakeSeers, self.myfakeSeers]) or request.getAgent() != wolf:
                        if request.getContent() in ['VOTE']:
                            target = request.getTarget2()
                            self.isFollow = True
                            if self.willvote != target:
                                self.willvote = target
                                return ttf.vote(target)
                            else:
                                return ttf.over()

        #VOTE宣言(明確な偽、自分への黒出し、最黒)
        target = self.MyTarget()
        if(self.willvote != target):
            self.willvote = target
            return ttf.vote(self.willvote)


        #ESTIMATE宣言
        if(self.myData.getTurn() < 10):
            talk = self.Estimate(self.willvote)
            if(talk != None):   return talk

        #BGCO
        if(self.isBlacked and not self.isCall):
            self.isCall = True
            return ttf.comingout(self.agentIdx,'BODYGUARD')

        # 対抗 CO が出てきたとき限定で BGCO
        # probably 7/10
        x = random.randint(0,10)
        y = random.randint(0,5)
        if ( len(self.myData.getTodayBGCOAgentList()) > 0 and x > y  and not self.isCall):
            self.isCall = True
            return ttf.comingout(self.agentIdx, 'BODYGUARD')

        #REQUEST宣言
        if(self.isRequest or self.isRequestAll):
            fakeSeers   = self.alivefakeSeers + self.alivefakeMediums
            talk = self.Request(fakeSeers)
            if(talk != None):   return talk

        """
        def agree(talktype, day, id):
            return 'AGREE ' + talktype + ' day' + str(day) + ' ID:' + str(id)

        def disagree(talktype, day, id):
            return 'DISAGREE ' + talktype + ' day' + str(day) + ' ID:' + str(id)
        """

        # これから gurd する対象を伝える
        # 護衛対象明示 -> 真占い師確定時のみ
        x = random.randint(0,10)
        y = random.randint(0,5)
        if self.isCall and len(self.myData.getAliveSeerCOAgentList()) == 1 and self.isRealSeer and x > y:
            self.declare = True
            #return ttf.guard(self.guard()) ->guardは1日1度しか呼ばれないことを想定しています
            if self.myguard != None and self.myData.isAlive(self.myguard):
                return ttf.guard(self.myguard)


        return ttf.over()