@Override public Agent vote() { List<Agent> whiteAgent = new ArrayList<>(); List<Agent> blackAgent = new ArrayList<>(); for (Judge j : getMyJudgeList()) { if (getLatestDayGameInfo().getAliveAgentList().contains(judge.getTarget())) { switch (j.getResult()) { case HUMAN: whiteAgent.add(judge.getTarget()); break; case WEREWOLF: blackAgent.add(judge.getTarget()); break; } } } if (blackAgent.size() > 0) { return randomSelect(blackAgent); } else { List<Agent> voteCandidates = new ArrayList<Agent>(); voteCandidates.addAll(getLatestDayGameInfo().getAliveAgentList()); voteCandidates.remove(getMe()); voteCandidates.removeAll(whiteAgent); return randomSelect(voteCandidates); } }
@Override public String talk() { if (!isComingOut) { String comingoutTalk = TemplateTalkFactory.comingout(getMe(), getMyRole()); isComingOut = true; return comingoutTalk; } else { for (Judge judge : getMyJudgeList()) { if (!myToldJudgeList.contains(judge)) { String resultTalk = TemplateTalkFactory.divined(judge.getTarget(), judge.getResult()); myToldJudgeList.add(judge); return resultTalk; } } } return Talk.OVER; }
@Override public String talk() { if (!isComingout) { isComingout = true; String ret = TemplateTalkFactory.comingout(getMe(), getMyRole()); return ret; } if (!tellMyJudge) { tellMyJudge = true; Judge judge = this.getLatestDayGameInfo().getDivineResult(); if (judge != null) { String ret = TemplateTalkFactory.divined(judge.getTarget(), judge.getResult()); return ret; } } return Talk.OVER; }
public static Set<SelectAction> getAbleSelectActions(Information info) { Set<SelectAction> actions = new HashSet<SelectAction>(); List<Agent> seerList = info.getSeerCOList(); List<Agent> mediumList = info.getMediumCOList(); Set<Agent> taged = new HashSet<Agent>(); Set<Agent> surviver = (Set<Agent>) info.getSurviver(); if (seerList.size() > 0) { Agent seer = seerList.get(0); if (surviver.contains(seer)) { actions.add(S1); taged.add(seer); } Set<Judge> judges = info.getJudgeSets().get(seer); if (judges != null) { for (Judge judge : judges) { if (surviver.contains(judge.getTarget())) { if (judge.getResult() == Species.HUMAN) { actions.add(JH1); } else { actions.add(JW1); } taged.add(judge.getTarget()); } } } } if (seerList.size() > 1) { Agent seer = seerList.get(1); if (surviver.contains(seer)) { actions.add(S2); taged.add(seer); } Set<Judge> judges = info.getJudgeSets().get(seer); if (judges != null) { for (Judge judge : judges) { if (surviver.contains(judge.getTarget())) { if (judge.getResult() == Species.HUMAN) { actions.add(JH2); } else { actions.add(JW2); } taged.add(judge.getTarget()); } } } } if (seerList.size() > 2) { Agent seer = seerList.get(2); if (surviver.contains(seer)) { actions.add(S3); taged.add(seer); } Set<Judge> judges = info.getJudgeSets().get(seer); if (judges != null) { for (Judge judge : judges) { if (surviver.contains(judge.getTarget())) { if (judge.getResult() == Species.HUMAN) { actions.add(JH3); } else { actions.add(JW3); } taged.add(judge.getTarget()); } } } } if (mediumList.size() > 0 && surviver.contains(mediumList.get(0))) { actions.add(M1); taged.add(mediumList.get(0)); } if (mediumList.size() > 1 && surviver.contains(mediumList.get(1))) { actions.add(M2); taged.add(mediumList.get(1)); } if (mediumList.size() > 2 && surviver.contains(mediumList.get(2))) { actions.add(M3); taged.add(mediumList.get(2)); } if (!taged.containsAll(surviver)) { actions.add(OT); } actions.add(RA); return actions; }
public List<Agent> getSelectedAgents(Information info) { List<Agent> agents = new ArrayList<Agent>(); try { switch (this) { case S1: case JW1: case JH1: Agent seer = info.getSeerCOList().get(0); if (this == S1) { agents.add(seer); break; } for (Judge judge : info.getJudgeSets().get(seer)) { if (this == JH1 && judge.getResult() == Species.HUMAN) { agents.add(judge.getTarget()); } else if (this == JW1 && judge.getResult() == Species.WEREWOLF) { agents.add(judge.getTarget()); } } break; case S2: case JW2: case JH2: Agent seer2 = info.getSeerCOList().get(1); if (this == S2) { agents.add(seer2); break; } for (Judge judge : info.getJudgeSets().get(seer2)) { if (this == JH2 && judge.getResult() == Species.HUMAN) { agents.add(judge.getTarget()); } else if (this == JW2 && judge.getResult() == Species.WEREWOLF) { agents.add(judge.getTarget()); } } break; case S3: case JW3: case JH3: Agent seer3 = info.getSeerCOList().get(2); if (this == S3) { agents.add(seer3); break; } for (Judge judge : info.getJudgeSets().get(seer3)) { if (this == JH3 && judge.getResult() == Species.HUMAN) { agents.add(judge.getTarget()); } else if (this == JW3 && judge.getResult() == Species.WEREWOLF) { agents.add(judge.getTarget()); } } break; case M1: agents.add(info.getMediumCOList().get(0)); break; case M2: agents.add(info.getMediumCOList().get(1)); break; case M3: agents.add(info.getMediumCOList().get(2)); break; case OT: agents.addAll(info.getSurviver()); List<Agent> remover = new ArrayList<Agent>(); for (int i = 0; i < info.getSeerCOList().size(); i++) { if (i >= 3) { break; } Agent a = info.getSeerCOList().get(i); remover.add(a); if (info.getJudgeSets().get(a) != null) { for (Judge judge : info.getJudgeSets().get(a)) { remover.add(judge.getTarget()); } } } for (int i = 0; i < info.getMediumCOList().size(); i++) { if (i >= 3) { break; } Agent a = info.getMediumCOList().get(i); remover.add(a); } agents.removeAll(remover); if (agents.size() == 0) { System.out.println("a"); } return agents; case RA: agents.addAll(info.getSurviver()); if (agents.size() == 0) { System.out.println("aaaa"); } return agents; default: break; } } catch (Exception e) { System.out.println("不適切なActionの選択:" + this); e.printStackTrace(); } Set<Agent> surviver = (Set<Agent>) info.getSurviver(); List<Agent> remover = new ArrayList<Agent>(); for (Agent agent : agents) { if (!surviver.contains(agent)) { remover.add(agent); } } agents.removeAll(remover); if (agents.size() == 0) { System.out.println("aa"); } return agents; }
@Override public Agent vote() { List<Agent> whiteAgent = new ArrayList<Agent>(); List<Agent> blackAgent = new ArrayList<Agent>(); for (Judge judge : getMyJudgeList()) { if (getLatestDayGameInfo().getAliveAgentList().contains(judge.getTarget())) { switch (judge.getResult()) { case HUMAN: whiteAgent.add(judge.getTarget()); break; case WEREWOLF: blackAgent.add(judge.getTarget()); break; } } } if (blackAgent.size() > 0) { return randomSelect(blackAgent); } else { List<Agent> voteCandidates = new ArrayList<Agent>(); if (fakeSeerCOAgent.size() > 0 && getLatestDayGameInfo().getAgentList().size() < 9) { for (Agent fake : fakeSeerCOAgent) { if (getLatestDayGameInfo().getAliveAgentList().contains(fake)) { voteCandidates.add(fake); } } } if (voteCandidates.size() > 0) { return randomSelect(voteCandidates); } else { voteCandidates.addAll( COResult.aliveGrayForMe(getLatestDayGameInfo().getAliveAgentList(), getMe())); voteCandidates.removeAll(whiteAgent); if (voteCandidates.size() > 0) { return randomSelect(voteCandidates); } else { voteCandidates.addAll(getLatestDayGameInfo().getAliveAgentList()); voteCandidates.removeAll(COResult.getSeerCOAgent()); voteCandidates.removeAll(COResult.getMediumCOAgent()); voteCandidates.removeAll(whiteAgent); if (voteCandidates.size() > 0) { return randomSelect(voteCandidates); } else { for (Agent seer : COResult.getSeerCOAgent()) { if (getLatestDayGameInfo().getAliveAgentList().contains(seer)) { voteCandidates.add(seer); } voteCandidates.remove(getMe()); } if (voteCandidates.size() > 0) { return randomSelect(voteCandidates); } else { voteCandidates.addAll(getLatestDayGameInfo().getAliveAgentList()); voteCandidates.remove(getMe()); return randomSelect(voteCandidates); } } } } } }