コード例 #1
0
 public Fowl(ICoopSimulation _coop)
 {
     ID   = Guid.NewGuid();
     Coop = _coop;
     Coop.CouplingNotify += MatingBegins;
     Coop.DeathNotify    += DeathBegins;
     BirthDate            = Coop.Time;
     IsAlive              = true;
 }
コード例 #2
0
            public ConsoleApplication(ICoopSimulation coopSimulation)
            {
                IConfiguration config = new ConfigurationBuilder().SetBasePath(Path.Combine(AppContext.BaseDirectory))
                                        .AddJsonFile("appsettings.json", true, true)
                                        .Build();

                SimulationCyclesInMonth    = Convert.ToInt32(config.GetSection("SimulationCyclesInMonth").Value);
                _coopSimulation            = coopSimulation;
                _coopSimulation.Time       = StartDate;
                _coopSimulation.Population = new HashSet <IFowl>()
                {
                    new FemaleRabbit(_coopSimulation)
                    {
                        BirthDate = StartDate.AddYears(-1)
                    },
                    new MaleRabbit(_coopSimulation)
                    {
                        BirthDate = StartDate.AddYears(-1)
                    },
                };

                EndDate = StartDate.AddMonths(SimulationCyclesInMonth);
            }
コード例 #3
0
 public Rabbit(ICoopSimulation coop) : base(coop)
 {
 }
コード例 #4
0
 public MaleRabbit(ICoopSimulation _coop) : base(_coop)
 {
     Coop = _coop;
 }
コード例 #5
0
 public FemaleRabbit(ICoopSimulation _coop) : base(_coop)
 {
     Coop              = _coop;
     Coop.BirthNotify += BirthBegins;
 }