private void addToCellGroup(ArrayList<AgentsGroup> cellGroups, BaseAgent agent) {
        AgentsGroup agentGroup;
        BaseAgent groupRepresentative;
        BaseInformation agentInformation, groupRepresentativeInformation;
        ArrayList<HumanAgent> humans;
        
        agentGroup       = null;
        agentInformation = this.population.get(agent);
        
        if(!AgentsUtils.isHumanInformation(agentInformation) 
           || ((HumanInformation)agentInformation).getHealthStatus() != HumanHealthStatus.Infected) {
            
            //Look for the group where the agent is placed
            for(AgentsGroup group: cellGroups) {
                //Take a representative of the group
                humans = group.getHumans();

                if(!humans.isEmpty()) {
                    groupRepresentative = humans.get(0);
                }
                else {
                    groupRepresentative = group.getZombies().get(0);
                }

                //If there aren't any walls between the agent and the representative of the group,
                //this will be the agent's group
                groupRepresentativeInformation = this.population.get(groupRepresentative);

                if(!this.thereIsAWallBetween(agentInformation.getPosition(), groupRepresentativeInformation.getPosition())) {
                    agentGroup = group;
                    break;
                }
            }

            //If the agent doesn't belong to any of the given groups, a new group
            //is created
            if(agentGroup == null) {
                agentGroup = new AgentsGroup();

                cellGroups.add(agentGroup);
            }

            //Add the agent to the group
            if(AgentsUtils.isHuman(agent)) {
                //The agent is human
                agentGroup.getHumans().add((HumanAgent)agent);
            }
            else {
                //The agent is zombie
                agentGroup.getZombies().add((ZombieAgent)agent);
            }
        
        }
        
    }