/** * Environment's primary execution function * * <ul> * <li>{@link #processTeamHunts() Processes Team Hunts} * <li>On {@link TurnType#TeamSelect Team Select} turn, calls the {@link AbstractFreeAgentGroup * Free Agent Group} to put all {@link AbstractAgent agents} (who are not in {@link * AbstractGroupAgent groups}) int {@link HuntingTeam teams} * </ul> */ @Override protected void updatePhysicalWorld() { processTeamHunts(); // Deal with ungrouped agents having teams formed if (fAGroup != null && dmodel.getTurnType() == TurnType.TeamSelect) { List<HuntingTeam> teams = fAGroup.selectTeams(dmodel.getUngroupedAgents()); for (HuntingTeam team : teams) { for (String agent : team.getMembers()) { sim.getPlayer(agent).enqueueInput(new HuntOrder(sim.getTime(), team)); logger.log( Level.FINE, "FreeAgentsGroup has created team {0} including {1}", new Object[] {team.hashCode(), nameOf(agent)}); } } } // Energy used on hunting, so this is when food is consumed if (dmodel.getTurnType() == TurnType.GoHunt) { for (Participant agent : sim.players.values()) { if (sim.isParticipantActive(agent.getId())) { if (agent instanceof ise.mace.participants.AbstractAgent) { agent.enqueueInput(new ConsumeFood(dmodel.getTime())); } } } } }
/** * Returns a list of all {@link AbstractAgent agents} that are not currently part of a {@link * AbstractGroupAgent group} * * @return The IDs of all un-grouped agents * @see #getAgentById(java.lang.String) getAgentById */ List<String> getUngroupedAgents() { return dmodel.getUngroupedAgents(); }