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 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] == 'divine': 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, 2) else: breakdown.updateAttacked(dst) if self.ability_result != '': self.talkQueue.push(Node(100, self.ability_result)) if game_info['day'] != 0: poss, wolf, seer, scores = breakdown.getTop() if poss[0] != 0: wolf = wolf[0] seer = seer[0] poss = poss[0] if scores[wolf, 2] > 1.05 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.02 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] == 'guard': self.reported = False self.ability_result = history['text'][i] print("ab: " + self.ability_result) if self.ability_result != '': self.talkQueue.push(Node(100, self.ability_result)) self.comingout = True 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]) 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[int(x), 0]) self.tar = wolfs[-1] self.hold = wolfs[0] self.guardtar = human[-1] 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.comingout and not self.guard_say and self.skcnt < 2: self.talkQueue.push( Node(10 * scores[human[-1], 0], cb.guard(self.guardtar))) self.guard_say = True
def __init__(self, game_info, game_setting): self.game_info = game_info self.idx = game_info["agentIdx"] self.game_setting = game_setting self.voted = False self.requested = False self.estimated = False self.tar = 1 if self.idx != 1 else 2 self.hold = 1 if self.idx != 1 else 2 self.skcnt = 0 self.talk_cnt = 0 self.talkQueue = PriorityQueue() self.talkQueue.push(Node(0, cb.skip())) self.talkQueue.push(Node(0, cb.skip())) self.deadlist = []
def __init__(self, game_info, game_setting): super().__init__(game_info,game_setting) self.comingout_role = '' self.reported = False self.ability_result = '' self.divinelist = [] self.talkQueue.push(Node(150, cb.comingout(self.idx, "SEER")))
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 game_info['day'] != 2: if request == 'DAILY_INITIALIZE' and game_info['day'] != 0: self.reported = False self.ability_result = cb.divined(self.tar, "HUMAN") poss, wolf, seer, scores= breakdown.getTop() human = [x for x in range(1, 6) if x not in wolf and x not in self.deadlist and x != self.idx] human.sort(key = lambda x: scores[int(x), 0]) self.tar = human[-1] self.hold = human[0] if game_info['day'] != 0: if not self.reported: self.talkQueue.push(Node(100, self.ability_result)) self.reported = True if scores[human[0], 0] < 1.05 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.1 and not self.requested and len(human) >= 2 and self.skcnt < 2: self.talkQueue.push(Node(20 * scores[human[1], 2],cb.divine(human[1]))) self.requested = True if scores[human[-1], 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 : self.talkQueue.push(Node(100, cb.comingout(self.idx, "POSSESSED"))) poss, wolf, seer, scores= breakdown.getTop() self.tar = [x for x in range(1, 6) if x not in wolf and x not in self.deadlist][0] self.talkQueue.push(Node(100, cb.vote(self.tar)))
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) if request == 'DAILY_INITIALIZE' and game_info['day'] != 0: self.reported = False self.ability_result = cb.divined(self.tar, "HUMAN") poss, wolfs, scores= breakdown.getTop() wolfs = sorted(wolfs, key=lambda x: scores[int(x), 1]) 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[int(x), 0]) self.tar = human[-1] self.hold = human[0] if game_info['day'] != 0: if not self.reported: self.talkQueue.push(Node(100, self.ability_result)) self.reported = True if scores[human[0], 0] < 1.05 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 scores[wolfs[-1], 0] > 1.1 and not self.requested and self.skcnt < 2: self.talkQueue.push(Node(20 * scores[human[1], 1],cb.divine(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(human[0], "WEREWOLF"))) self.estimated = True
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
def update(self, game_info, history, request, breakdown): self.game_info = game_info print(request) if request == "DAILY_INITIALIZE": self.talkQueue.push(Node(0, cb.skip())) self.talkQueue.push(Node(0, cb.skip())) self.voted = False self.estimated = False self.requested = False self.talk_cnt = 0 self.skcnt = 0 # print("reset flags") for i in range(history.shape[0]): if history.type[i] == "talk": text = history.text[i].split() if text[0] == "COMINGOUT": # Coming out時の処理 idx = self.getAgentIdx(text[1]) role = text[2] breakdown.updateCo(idx, role) print("co " + str(idx) + " " + text[2]) elif text[0] == "DIVINED": # 占い結果の処理 src = int(history.agent[i]) dst = self.getAgentIdx(text[1]) species = text[2] breakdown.updateDivined(src, dst, species) print("divine " + str(src) + " " + text[2] + " " + str(dst)) elif text[0] == "ESTIMATE": # 推測時の処理 src = int(history.agent[i]) dst = self.getAgentIdx(text[1]) species = text[2] print("estimate " + str(src) + " " + text[2] + " " + str(dst)) elif text[0] == "VOTE": # 投票宣言の処理 src = int(history.agent[i]) dst = self.getAgentIdx(text[1]) print("vote " + str(src) + " -> " + str(dst)) elif re.match("REQUEST", text[0]): # リクエストの処理 print("request...") elif history.type[i] == "vote": # 投票時の処理 src = int(history.idx[i]) dst = int(history.agent[i]) print("agent " + str(src) + " voted agent " + str(dst)) breakdown.updateVote(src, dst) elif history.type[i] == "execute": # 処刑時の処理 idx = int(history.agent[i]) breakdown.updateExecuted(idx) print("agent " + str(idx) + " executed") self.deadlist.append(idx) elif history.type[i] == "dead": # 人狼襲撃時の処理 idx = int(history.agent[i]) print("agent " + str(idx) + " attacked") self.deadlist.append(idx) breakdown.updateAttacked(idx) if request != "DAILY_INITIALIZE": breakdown.compress() breakdown.update()
def __init__(self, game_info, game_setting): super().__init__(game_info, game_setting) self.comingout_role = '' self.reported = False self.ability_result = '' self.talkQueue.push(Node(100, cb.comingout(self.idx, "MEDIUM")))