Package ise.mace.participants

Examples of ise.mace.participants.PublicAgentDataModel


    Rectangle rect = g.getClipBounds();
    int size = 0;

    for (Map.Entry<String, AbstractAgent> entry1 : players.entrySet())
    {
      PublicAgentDataModel agent1_dm = entry1.getValue().getDataModel();

      if (agent1_dm.getGroupId() != null && PublicEnvironmentConnection.getInstance().getGroupById(
              agent1_dm.getGroupId()).getMemberList().size() > 1)
      {

        for (Map.Entry<String, AbstractAgent> entry2 : players.entrySet())
        {
          PublicAgentDataModel agent2_dm = entry2.getValue().getDataModel();

          if (agent2_dm.getGroupId() != null)
          {
            if (!entry1.getKey().equals(entry2.getKey()) && agent1_dm.getGroupId().equals(
                    agent2_dm.getGroupId()))
            {
              g.setColor(agent_c);
              x1 = agent1_dm.getEconomicBelief() * (rect.width / correction);
              x2 = agent2_dm.getEconomicBelief() * (rect.width / correction);
              y1 = agent1_dm.getSocialBelief() * (rect.height / correction);
              y2 = agent2_dm.getSocialBelief() * (rect.height / correction);
              g.drawLine((int)x1 + 1, (int)y1 + 1, (int)x2 + 1, (int)y2 + 1);
              size = PublicEnvironmentConnection.getInstance().getGroupById(
                      agent1_dm.getGroupId()).getMemberList().size();

              float hue = getGroupColour(agent1_dm.getGroupId());
View Full Code Here


      return null;
    }

    List<String> members = this.getDataModel().getHuntingTeam().getMembers();
    int teamSize = members.size();
    PublicAgentDataModel player = this.getDataModel();
    PublicAgentDataModel opponent = null;
    Food stag = this.getFoodTypes().get(0);
    Food hare = this.getFoodTypes().get(1);

    if (teamSize > 1)
    {
      int oppIdx = (members.get(0).equals(this.getId())) ? 1 : 0;
      opponent = getConn().getAgentById(members.get(oppIdx));
    }

    boolean hasOpponent = (null != opponent);
    History<Food> opponentHuntingHistory = null;
    boolean opponentLastHuntStag = false;
    double opponentStagStrategy = 0;
    if (hasOpponent)
    {
      opponentHuntingHistory = opponent.getHuntingHistory();

      if (null != opponentHuntingHistory &&
        opponentHuntingHistory.size() > 1)
      {
        Food opponentLastHunt = opponentHuntingHistory.getValue(1);
View Full Code Here

    //remove already tracked groups
    newAgents.removeAll(trackedAgents.keySet());

    for (String a : newAgents)
    {
      PublicAgentDataModel agent = ec.getAgentById(a);
      int agentid = ++agentIdGenerator;
      wrap.agentAdd(a, agentid, round, agent.getName());
      agentIdMap.put(a, agentid);
      //add the agent to tracked groups
      trackedAgents.put(a, agent);
    }
  }
View Full Code Here

  private void getAgentRoundData()
  {
    for (Map.Entry<String, PublicAgentDataModel> entry : trackedAgents.entrySet())
    {
      PublicAgentDataModel agent = entry.getValue();
      try
      {
        //gets the agents groupid and maps it to database id for group
        //if agent group is null, the map returns 0 groupid

        int groupid = groupIdMap.get(agent.getGroupId());
        int agentid = agentIdMap.get(entry.getKey());
        wrap.agentRound(agentid, groupid, round, agent);
        for (Map.Entry<String, PublicAgentDataModel> entry2 : trackedAgents.entrySet())
        {
          Double trust = agent.getTrust(entry2.getKey());
          if (trust != null)
          {
            int agentid_other = agentIdMap.get(entry2.getKey());
            wrap.agentTrust(agentid, agentid_other, trust, round);
          }
        }
      }
      catch (NullPointerException ex)
      {
        logger.log(Level.WARNING, "Null Exception: For agent {0} for round {1}"
                + " ", new Object[]
                {
                  agent.getName(), round
                });
      }
    }
  }
View Full Code Here

      final Hunt act = (Hunt)action;
      final Food food = dmodel.getFoodById(act.getFoodTypeId());

      // This line gets the agents datamodel
      // Just trust me on that one :P
      final PublicAgentDataModel am = ((AbstractAgent)sim.getPlayer(actorID)).getDataModel();
      if (am.getHuntingTeam() == null)
      {
        Input result;
        if (food.getHuntersRequired() <= 1)
        {
          result = new HuntResult(actorID, food.getNutrition(),
                  food.getNutrition(), dmodel.getTime());
        }
        else
        {
          result = new HuntResult(actorID, 0, 0, dmodel.getTime());
        }
        sim.getPlayer(actorID).enqueueInput(result);
      }
      else
      {
        if (!storedHuntResults.containsKey(am.getHuntingTeam()))
        {
          storedHuntResults.put(am.getHuntingTeam(),
                  new LinkedList<TeamHuntEvent>());
        }
        storedHuntResults.get(am.getHuntingTeam()).add(new TeamHuntEvent(act,
                actorID));
      }
      logger.log(Level.FINE, "Agent {0} hunted {1}{2}", new Object[]
              {
                nameOf(actorID),
                food.getName(),
                am.getHuntingTeam() == null ? " alone." : " with team " + am.getHuntingTeam().hashCode()
              });
      return null;
    }
View Full Code Here

TOP

Related Classes of ise.mace.participants.PublicAgentDataModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.