コード例 #1
0
ファイル: KogSeerPlayer.java プロジェクト: ry0u/jinrou-aiwolf
  @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);
    }
  }
コード例 #2
0
ファイル: KogSeerPlayer.java プロジェクト: ry0u/jinrou-aiwolf
  @Override
  public Agent divine() {
    List<Agent> aliveAgentList = getLatestDayGameInfo().getAliveAgentList();
    aliveAgentList.remove(this.getMe());

    if (!isAgainstSeer) {
      return randomSelect(aliveAgentList);
    } else {
      double flag = Math.random();
      if (0.00D <= flag && flag < 0.05D) {
        List<Agent> againstSeer = new ArrayList<>();
        for (Agent agent : this.comingoutRole.keySet()) {
          Role role = this.comingoutRole.get(agent);
          if (role.equals(Role.SEER) && !agent.equals(this.getMe())) {
            againstSeer.add(agent);
          }
        }

        if (againstSeer.size() > 0) {
          return randomSelect(againstSeer);
        }
      } else if (0.05 <= flag && flag < 0.75D) {
        List<Agent> anotherDivinedAgent = new ArrayList();
        for (int i = 0; i < this.anotherJudgeList.size(); i++) {
          Judge judge = anotherJudgeList.get(i);
          if (!anotherDivinedAgent.contains(judge.getTarget())) {
            anotherDivinedAgent.add(judge.getTarget());
          }
        }

        if (anotherDivinedAgent.size() > 0) {
          return randomSelect(anotherDivinedAgent);
        }
      }

      return randomSelect(aliveAgentList);
    }
  }
コード例 #3
0
ファイル: KogSeerPlayer.java プロジェクト: ry0u/jinrou-aiwolf
  @Override
  public void dayStart() {
    super.dayStart();

    this.tellMyJudge = false;
    this.readTalkNum = 0;

    if (getLatestDayGameInfo().getDivineResult() != null) {
      judge = getLatestDayGameInfo().getDivineResult();
      myJudgeList.add(judge);
    }

    HashMap<Agent, Role> newRole = new HashMap<>();
    List<Agent> aliveAgentList = this.getLatestDayGameInfo().getAliveAgentList();

    for (Agent agent : comingoutRole.keySet()) {
      if (aliveAgentList.contains(agent)) {
        newRole.put(agent, this.comingoutRole.get(agent));
      }
    }

    this.comingoutRole = newRole;
  }