def update(self, game_info, history, request, breakdown): super().update(game_info, history, request, breakdown) poss, wolfs, scores = breakdown.getTop() if poss[0] != 0: human = [ x for x in range(1, 16) if x not in wolfs and x not in self.deadlist ] human.sort(key=lambda x: scores[x][0]) self.tar = human[-1] self.hold = human[0] if game_info['day'] != 0: if scores[human[0], 1] > 1.2 and not self.voted and self.skcnt < 2: self.talkQueue.push( Node(10 * scores[human[0], 1], cb.vote(self.hold))) self.voted = True if len(human) >= 2 and scores[ human[1], 1] > 1.1 and not self.requested and self.skcnt < 2: self.talkQueue.push( Node(20 * scores[human[1], 1], cb.request(cb.request_div(human[1])))) self.requested = True if scores[human[0], 1] > 1.0 and not self.estimated and self.skcnt < 2: self.talkQueue.push( Node(30, cb.estimate(human[0], "WEREWOLF"))) self.estimated = True
def talk(self): print("Executing talk...") if self.role == "WEREWOLF": if self.player_map[self.current_target]["revenge"] is False: print("Voting on random target") else: print("Voting for revenge!") # Talking against a target has 3 steps: (0) first estimate, # then (1) state your vote, then (>2) start requesting other # agents to vote against the current target if self.player_map[self.current_target]["targetStatus"] == 0: talk = cb.estimate(self.current_target, "WEREWOLF") elif self.player_map[self.current_target]["targetStatus"] == 1: talk = cb.vote(self.current_target) else: talk = cb.request(cb.vote(self.current_target)) self.player_map[self.current_target]["targetStatus"] += 1 else: selected = randomPlayerId(self.base_info) talk = cb.vote(selected) return talk
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))
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))
def update(self, game_info, history, request, breakdown): super().update(game_info, history, request, breakdown) poss, wolf, seer, scores= breakdown.getTop() wolf = wolf[0] seer = seer[0] poss = poss[0] self.tar = wolf self.hold = poss if game_info['day'] != 0: if scores[wolf, 2] > 1.02 and not self.voted and self.skcnt < 2: self.talkQueue.push(Node(10 * scores[wolf, 2] ,cb.vote(self.tar))) self.voted = True if scores[wolf, 2] > 1.01 and not self.requested and self.skcnt < 2: self.talkQueue.push(Node(20 * scores[wolf, 2],cb.request(cb.request_div(self.hold)))) self.requested = True if scores[wolf, 2] > 1.0 and not self.estimated and self.skcnt < 2: self.talkQueue.push(Node(30,cb.estimate(wolf, "WEREWOLF"))) self.estimated = True
def update(self, game_info, history, request, breakdown): super().update(game_info, history, request, breakdown) if request == 'DAILY_INITIALIZE': for i in range(history.shape[0]): if history['type'][i] == 'identify': self.reported = False self.ability_result = history['text'][i] print("ab: " + self.ability_result) text = history['text'][i].split() dst = self.getAgentIdx(text[1]) species = text[2] if species == "WEREWOLF": breakdown.updateDeterministic(dst, 1) else: breakdown.updateAttacked(dst) if self.ability_result != '': self.talkQueue.push(Node(100, self.ability_result)) poss, wolfs, scores = breakdown.getTop() if poss[0] != 0: wolfs = sorted(wolfs, key=lambda x: scores[int(x), 1]) self.tar = wolfs[-1] self.hold = wolfs[0] if game_info['day'] != 0: if scores[wolfs[-1], 1] > 1.15 and not self.voted and self.skcnt < 2: self.talkQueue.push( Node(10 * scores[wolfs[-1], 1], cb.vote(self.tar))) self.voted = True if scores[wolfs[-1], 1] > 1.1 and not self.requested and self.skcnt < 2: self.talkQueue.push( Node(20 * scores[wolfs[0], 1], cb.request(cb.request_div(self.hold)))) self.requested = True if scores[wolfs[-1], 1] > 1.0 and not self.estimated and self.skcnt < 2: self.talkQueue.push( Node(30, cb.estimate(wolfs[1], "WEREWOLF"))) self.estimated = True
def update(self, game_info, history, request, breakdown): super().update(game_info, history, request, breakdown) if game_info['day'] != 2: if request == 'DAILY_INITIALIZE': self.reported = False self.ability_result = '' poss, wolf, seer, scores = breakdown.getTop() wolf = wolf[0] seer = seer[0] poss = poss[0] human = [x for x in range(1, 6) if x != wolf] human.sort(key=lambda x: scores[int(x), 0]) self.tar = human[-1] self.hold = human[0] if game_info['day'] != 0: if scores[human[0], 2] > 1.02 and not self.voted and self.skcnt < 2: self.talkQueue.push( Node(10 * scores[human[0], 2], cb.vote(self.hold))) self.voted = True if scores[human[1], 2] > 1.01 and not self.requested and self.skcnt < 2: self.talkQueue.push( Node(20 * scores[human[1], 2], cb.request(cb.request_div(human[1])))) self.requested = True if scores[human[0], 2] > 1.0 and not self.estimated and self.skcnt < 2: self.talkQueue.push( Node(30, cb.estimate(human[0], "WEREWOLF"))) self.estimated = True else: for i in range(history.shape[0]): if history.type[i] == "talk": txt = history.text[i].split() if txt[0] == "COMINGOUT" and txt[2] == "POSSESSED": self.hold = self.getAgentIdx(txt[1]) self.tar = self.getAgentIdx(txt[1])
def update(self, game_info, history, request, breakdown): super().update(game_info, history, request, breakdown) poss, wolfs, scores = breakdown.getTop() wolfs = sorted([x for x in wolfs if x not in self.deadlist], key=lambda x: scores[int(x), 1]) self.tar = wolfs[-1] self.hold = wolfs[0] if game_info['day'] != 0: if scores[wolfs[-1], 1] > 1.15 and not self.voted and self.skcnt < 2: self.talkQueue.push( Node(10 * scores[wolfs[-1], 1], cb.vote(self.tar))) self.voted = True if self.tar != self.hold and self.skcnt < 2: if scores[wolfs[-1], 1] > 1.1 and not self.requested: self.talkQueue.push( Node(20 * scores[wolfs[0], 1], cb.request(cb.request_div(self.hold)))) self.requested = True if scores[wolfs[-1], 1] > 1.0 and not self.estimated: self.talkQueue.push( Node(30, cb.estimate(wolfs[1], "WEREWOLF"))) self.estimated = True