예제 #1
0
  /**
   * Builds a bot.Info object for given bot
   *
   * @param botID
   * @return A {@link brain.BrainInfo} for specified bot
   */
  public BrainInfo getBotInfo(int botID) {
    BotEntity observer = get(botID);
    AbsPos observerPos = getBotPosition(botID);

    Collection<AbsPos> visPoints = Pos2D.getDiamondNear(observerPos, Settings.getVisionRadius());

    BrainInfo info = new BrainInfo(observer, observerPos, new Vision(this, visPoints, observerPos));
    return info;
  }
예제 #2
0
  // TODO move to util
  public Iterable<BotEntity> getProxBots(AbsPos near, int radius, Team matchTeam) {
    List<BotEntity> ret = new ArrayList<>();

    Collection<AbsPos> proxCells = Pos2D.getDiamondNear(near, radius);
    for (AbsPos cell : proxCells) {
      Entity proxEntity = get(cell);
      if (proxEntity instanceof BotEntity && ((BotEntity) proxEntity).getTeam().equals(matchTeam)) {
        ret.add((BotEntity) proxEntity);
      }
    }

    return ret;
  }