Exemple #1
0
 def talk(self):
     if not self.isCo and self.day == 1 and random.uniform(0, 1) <= 0.5:
         self.isCo = True
         return cb.COMINGOUT(self.agentIdx, "VILLAGER")
     elif not self.isVote:
         if self.mode == -1:
             return cb.skip()
         else:
             self.isVote = True
             return cb.VOTE(self.mode)
     elif not self.isBecause:
         self.isBecause = True
         if self.mode == -1:
             return cb.skip()
         else:
             self.isBecause = True
             return cb.BECAUSE(cb.ESTIMATE(self.mode, "WEREWOLF"),
                               cb.VOTE(self.mode))
     elif len(self.AGREESentenceQue) >= 1:
         AGREEText = self.AGREESentenceQue.pop()
         return cb.AGREE(AGREEText[0], AGREEText[1], AGREEText[2])
     elif len(self.DISAGREESentenceQue) >= 1:
         DISAGREEText = self.DISAGREESentenceQue.pop()
         return cb.DISAGREE(DISAGREEText[0], DISAGREEText[1],
                            DISAGREEText[2])
     elif self.isRequest:
         self.isRequest = True
         if self.mode == -1:
             return cb.skip()
         else:
             return cb.REQUEST("ANY", cb.VOTE(self.mode))
     else:
         return cb.skip()
Exemple #2
0
    def talk(self):
        if self.co_rate != 2:
            self.co_rate = random.uniform(0, 1)
        if not self.isCo and self.day == 1 and self.co_rate >= 0.5:
            self.isCo = True
            if self.co_rate == 2:
                return cb.AND(
                    cb.AGREE(self.agree_co[0], self.agree_co[1],
                             self.agree_co[2]),
                    cb.COMINGOUT(self.agentIdx, "VILLAGER"))
            else:
                return cb.COMINGOUT(self.agentIdx, "VILLAGER")
        elif not self.isVote:
            if int(sorted(self.suspicion.items(),
                          key=lambda x: x[1])[-1][1]) == 0:
                return cb.skip()
            self.voteop = int(
                sorted(self.suspicion.items(), key=lambda x: x[1])[-1][0])
            if self.old_voteop != self.voteop and self.old_voteop != None:
                return cb.DISAGREE(self.myESTIMATE[0], self.myESTIMATE[1],
                                   self.myESTIMATE[2])
            self.isVote = True
            self.old_voteop = self.voteop
            return cb.VOTE(self.voteop)

        elif not self.isBecause:
            if int(sorted(self.suspicion.items(),
                          key=lambda x: x[1])[-1][1]) == 0:
                return cb.skip()
            self.isBecause = True
            return cb.BECAUSE(cb.ESTIMATE(self.voteop, "WEREWOLF"),
                              cb.VOTE(self.voteop))
        elif not self.isRequestVote:
            if int(sorted(self.suspicion.items(),
                          key=lambda x: x[1])[-1][1]) == 0:
                return cb.skip()
            self.isRequestVote = True
            return cb.REQUEST("ANY", cb.VOTE(self.voteop))
        elif len(self.AGREESentenceQue) >= 1:
            AGREEText = self.AGREESentenceQue.pop()
            return cb.AGREE(AGREEText[0], AGREEText[1], AGREEText[2])
        elif len(self.DISAGREESentenceQue) >= 2:
            DISAGREEText = self.DISAGREESentenceQue.pop()
            return cb.DISAGREE(DISAGREEText[0], DISAGREEText[1],
                               DISAGREEText[2])
        index = 0
        while True:
            if index == self.playerNum:
                return cb.skip()
            if not self.CoFlag[index]:
                self.CoFlag[index] = True
                return cb.REQUEST(index, cb.COMINGOUT(index, "ANY"))
            else:
                index += 1
        return cb.skip()
Exemple #3
0
 def talk(self):
     if not self.isCo and self.day == 1:
         self.isCo = True
         if self.co_rate == 2:
             return cb.AND(
                 cb.AGREE(self.agree_co[0], self.agree_co[1],
                          self.agree_co[2]),
                 cb.COMINGOUT(self.agentIdx, "SEER"))
         else:
             return cb.COMINGOUT(self.agentIdx, "SEER")
     elif len(self.AGREESentenceQue) >= 1:
         AGREEText = self.AGREESentenceQue.pop()
         return cb.AGREE(AGREEText[0], AGREEText[1], AGREEText[2])
     elif len(self.DISAGREESentenceQue) >= 2:
         DISAGREEText = self.DISAGREESentenceQue.pop()
         return cb.DISAGREE(DISAGREEText[0], DISAGREEText[1],
                            DISAGREEText[2])
     elif not self.isVote:
         self.isVote = True
         self.voteop = int(
             sorted(self.suspicion.items(), key=lambda x: x[1])[-1][0])
         return cb.VOTE(self.voteop)
     elif not self.isBecause:
         self.isBecause = True
         return cb.BECAUSE(cb.ESTIMATE(self.voteop, "WEREWOLF"),
                           cb.VOTE(self.voteop))
     elif not self.isRequestVote:
         self.isRequestVote = True
         return cb.REQUEST("ANY", cb.VOTE(self.voteop))
     elif not self.isDivine:
         self.isDivine = True
         agent, role = self.divineans[0], self.divineans[1]
         self.divineans = None
         return cb.DIVINED(agent, role)
     index = 0
     while True:
         if index == self.playerNum:
             return cb.skip()
         if not self.CoFlag[index]:
             self.CoFlag[index] = True
             return cb.REQUEST(index, cb.COMINGOUT(index, "ANY"))
         else:
             index += 1
     return cb.skip()
Exemple #4
0
 def talk(self):
     if not self.isCo and self.day == 1:
         self.isCo = True
         return cb.COMINGOUT(self.agentIdx, "SEER")
     elif not self.isVote:
         if self.mode == -1:
             return cb.skip()
         else:
             self.isVote = True
             return cb.VOTE(self.mode)
     elif not self.isBecause:
         if self.mode == -1:
             return cb.skip()
         else:
             self.isBecause = True
             return cb.BECAUSE(cb.ESTIMATE(self.mode, "WEREWOLF"), cb.VOTE(self.mode))
     elif len(self.AGREESentenceQue) >= 1:
         AGREEText = self.AGREESentenceQue.pop()
         return cb.AGREE(AGREEText[0], AGREEText[1], AGREEText[2])
     elif len(self.DISAGREESentenceQue) >= 1:
         DISAGREEText = self.DISAGREESentenceQue.pop()
         return cb.DISAGREE(DISAGREEText[0], DISAGREEText[1], DISAGREEText[2])
     elif not self.isRequest:
         if self.mode == -1:
             return cb.skip()
         else:
             self.isRequest = True
             return cb.REQUEST("ANY", cb.VOTE(self.mode))
     elif not self.isDivined:
         if self.mode != -1:
             self.isDivined = True
             return cb.DIVINED(self.mode, "WEREWOLF")
         else:
             return cb.skip()
     else:
         return cb.skip()