Ejemplo n.º 1
0
        public Wallaby(
            System.Guid _id,
            rugby_sim.Grassland _layer,
            Mars.Interfaces.Layer.RegisterAgent _register,
            Mars.Interfaces.Layer.UnregisterAgent _unregister,
            Mars.Components.Environments.SpatialHashEnvironment <Wallaby> _WallabyEnvironment,
            int speed
            , double xcor = 0, double ycor = 0, int freq = 1)
        {
            _Grassland = _layer;
            ID         = _id;
            Position   = Mars.Interfaces.Environment.Position.CreatePosition(xcor, ycor);
            _Random    = new System.Random(ID.GetHashCode());
            this.speed = speed;
            _Grassland._WallabyEnvironment.Insert(this);
            _register(_layer, this, freq);
            _isAlive            = true;
            _executionFrequency = freq;
            {
                new System.Func <System.Tuple <double, double> >(() => {
                    var _taget15_245 = new System.Tuple <int, int>(_Random.Next(250),
                                                                   5);

                    var _object15_245 = this;

                    _Grassland._WallabyEnvironment.PosAt(_object15_245,
                                                         _taget15_245.Item1, _taget15_245.Item2
                                                         );
                    return(new Tuple <double, double>(Position.X, Position.Y));
                }).Invoke();
                has_ball = true;
                speed    = 1
                ;
            }
        }
Ejemplo n.º 2
0
        public AllBlack(
            System.Guid _id,
            rugby_sim.Grassland _layer,
            Mars.Interfaces.Layer.RegisterAgent _register,
            Mars.Interfaces.Layer.UnregisterAgent _unregister,
            Mars.Components.Environments.SpatialHashEnvironment <AllBlack> _AllBlackEnvironment,
            double speed
            , double xcor = 0, double ycor = 0, int freq = 1)
        {
            _Grassland = _layer;
            ID         = _id;
            Position   = Mars.Interfaces.Environment.Position.CreatePosition(xcor, ycor);
            _Random    = new System.Random(ID.GetHashCode());
            this.speed = speed;
            _Grassland._AllBlackEnvironment.Insert(this);
            _register(_layer, this, freq);
            _isAlive            = true;
            _executionFrequency = freq;
            {
                System.Console.WriteLine("Initializing");;
                new System.Func <System.Tuple <double, double> >(() => {
                    var _taget49_637 = new System.Tuple <int, int>(_Random.Next(200),
                                                                   _Random.Next(10)
                                                                   );

                    var _object49_637 = this;

                    _Grassland._AllBlackEnvironment.PosAt(_object49_637,
                                                          _taget49_637.Item1, _taget49_637.Item2
                                                          );
                    return(new Tuple <double, double>(Position.X, Position.Y));
                }).Invoke();
                speed = 0.2
                ;
            }
        }
Ejemplo n.º 3
0
        public Human(
            System.Guid _id,
            VirusSpreading.City _layer,
            Mars.Interfaces.Layer.RegisterAgent _register,
            Mars.Interfaces.Layer.UnregisterAgent _unregister,
            Mars.Components.Environments.SpatialHashEnvironment <Human> _HumanEnvironment,
            int Human_gain_by_age,
            int Vulnerable_class_ratio,
            int Obey_ratio,
            int Government_announce_date,
            int Initial_infected_rate,
            int Infection_rate1,
            int Infection_rate2
            , double xcor = 0, double ycor = 0, int freq = 1)
        {
            _City    = _layer;
            ID       = _id;
            Position = Mars.Interfaces.Environment.Position.CreatePosition(xcor, ycor);
            _Random  = new System.Random(ID.GetHashCode());
            this.Human_gain_by_age        = Human_gain_by_age;
            this.Vulnerable_class_ratio   = Vulnerable_class_ratio;
            this.Obey_ratio               = Obey_ratio;
            this.Government_announce_date = Government_announce_date;
            this.Initial_infected_rate    = Initial_infected_rate;
            this.Infection_rate1          = Infection_rate1;
            this.Infection_rate2          = Infection_rate2;
            _City._HumanEnvironment.Insert(this);
            _register(_layer, this, freq);
            _isAlive            = true;
            _executionFrequency = freq;
            {
                new System.Func <System.Tuple <double, double> >(() => {
                    var _taget35_1049 = new System.Tuple <int, int>(_Random.Next(city.DimensionX()
                                                                                 ),
                                                                    _Random.Next(city.DimensionY()
                                                                                 )
                                                                    );

                    var _object35_1049 = this;

                    _City._HumanEnvironment.PosAt(_object35_1049,
                                                  _taget35_1049.Item1, _taget35_1049.Item2
                                                  );
                    return(new Tuple <double, double>(Position.X, Position.Y));
                }).Invoke();
                R0        = 0;
                Ticks     = 0;
                LossTicks = 0;
                int Class = _Random.Next(100);
                if (Class < Vulnerable_class_ratio)
                {
                    {
                        Energy     = _Random.Next(Human_gain_by_age);
                        Vulnerable = true
                        ;
                    }
                    ;
                }
                else
                {
                    {
                        Energy = _Random.Next(Human_gain_by_age)
                                 + 40
                        ;
                    }
                    ;
                };
                int infect = _Random.Next(100);
                if (infect < Initial_infected_rate)
                {
                    {
                        Infected = true
                        ;
                    }
                    ;
                }
                ;
            }
        }