Exemple #1
0
        public void birthNew(Amoeba agent, AbstractEnvironmentType env)
        {
            //if (agent.curx <= 4 || agent.curx >= env.u - 4 || agent.cury <= 4 || agent.cury >= env.v - 4 || agent.curz <= 4 || agent.curz >= env.w - 4)
            //    return;
            if (env.isOutsideBorderRangeByIndex(agent.curx, agent.cury, agent.curz))
            {
                return;
            }
            //if (agent.curx == agent.cury || agent.curx == agent.curz)
            //  return;
            Point3d newPos = env.getNeighbourhoodFreePosByIndex(agent.curx, agent.cury, agent.curz, 1, util);

            if (newPos.X == -1 || newPos.Y == -1 || newPos.Y == -1)
            {
                return;
            }
            _current_id++;
            int    thisindex = _current_id - 1;
            Amoeba newAmo    = new Amoeba(thisindex);

            newAmo.initializeAmoeba(newPos.X, newPos.Y, newPos.Z, env, util);
            newAmo.prev_loc = agent.Location;
            //newAmo.initializeAmoeba(agent.curx, agent.cury, agent.curz, 2, _grid, util);
            newAmo.selectRandomDirection(env, util, agent.orientation);
            //Amoeba newAmo = new Amoeba(_current_population - 1, _sense_angle, _rotate_angle, _sense_offset, _detectDir, _death_distance, _speed, _pcd, _depT);
            //Point3d birthPlace = _grid.getRandomBirthPlace(util);
            //newAmo.initializeAmoeba((int) birthPlace.X, (int) birthPlace.Y, (int) birthPlace.Z, 3, _grid, util);
            //newAmo._guide_factor = guide_factor;
            _toborn_population.Add(newAmo);
        }
Exemple #2
0
 public void doDivisionTest(AbstractEnvironmentType env)
 {
     _divide = false;
     if (env.isOutsideBorderRangeByIndex(curx, cury, curz))
     {
         return;
     }
     if (isWithinBirthRange(curx, cury, curz, env))
     {
         _divide = true;
     }
 }
Exemple #3
0
 public void doDeathTest(AbstractEnvironmentType env)
 {
     _die = false;
     if (env.isOutsideBorderRangeByIndex(curx, cury, curz) && PhysaSetting.border_type != 2)
     {
         _die = true;
     }
     //if (env.envdata[curx, cury, curz] == 2)
     //  _die = true;
     //return;
     if (isOutsideSurvivalRange(curx, cury, curz, env))
     {
         _die = true;
     }
 }
Exemple #4
0
 public void doDivisionTest(AbstractEnvironmentType env)
 {
     _divide = false;
     if (env.isOutsideBorderRangeByIndex(curx, cury, curz))
         return;
     if (isWithinBirthRange(curx, cury, curz, env))
     {
         _divide = true;
     }
 }
Exemple #5
0
 public void doDeathTest(AbstractEnvironmentType env)
 {
     _die = false;
     if (env.isOutsideBorderRangeByIndex(curx, cury, curz) && PhysaSetting.border_type != 2)
     {
         _die = true;
     }
     //if (env.envdata[curx, cury, curz] == 2)
     //  _die = true;
     //return;
     if (isOutsideSurvivalRange(curx, cury, curz, env))
         _die = true;
 }