Пример #1
0
  @Override
  public void update(GameInfo gameInfo) {
    super.update(gameInfo);

    List<Talk> talkList = gameInfo.getTalkList();

    for (int i = readTalkNum; i < talkList.size(); i++) {
      Talk talk = talkList.get(i);
      Utterance utterance = new Utterance(talk.getContent());

      if (utterance.getTopic().equals(Topic.COMINGOUT)) {
        this.comingoutRole.put(utterance.getTarget(), utterance.getRole());
        if (utterance.getRole().equals(Role.SEER)) {
          this.isAgainstSeer = true;
        }
      }

      if (utterance.getTopic().equals(Topic.DIVINED)) {
        if (!talk.getAgent().equals(this.getMe())) {
          Judge judge =
              new Judge(
                  getLatestDayGameInfo().getDay(),
                  talk.getAgent(),
                  utterance.getTarget(),
                  utterance.getResult());
          this.anotherJudgeList.add(judge);
        }
      }
    }
  }
Пример #2
0
  public Agent randomSelect(List<Agent> list) {
    Random rand = new Random();
    int d = rand.nextInt(list.size());

    List<Agent> ret = getLatestDayGameInfo().getAliveAgentList();
    return ret.get(d);
  }
Пример #3
0
  @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);
    }
  }