Exemplo n.º 1
0
        public CoronaPatient(Random r, CoronaParameter c)
        {
            id               = 0;
            family_id        = 0;
            source_id        = 0;
            checkup          = 0;
            infected_number  = 0;
            day              = 0;
            day_to_dead      = 0;
            dead             = 0;
            complete_cure    = 0;
            age              = r.Next(100);
            gender           = r.Next(2);
            family_number    = r.Next(1, 6);
            care_level       = r.Next(1, 6); //1 =何もしない 2=クリニック 3=呼吸器内科 4=入院 5=確診入院
            checkup_relate   = r.Next(2);
            use_mask         = r.Next(2);    // 0=未着用 1=着用
            sick_period      = r.Next(7, 14);
            contact_number   = r.Next(0, c.max_contact_number);
            activitiy_factor = r.NextDouble();
            train_fator      = r.NextDouble();
            room_factor      = r.NextDouble();
            serious_factor   = r.NextDouble();
            health_factor    = r.NextDouble();

            double death_rate_int = (int)(c.death_rate * 100);
            int    destiny_dice   = r.Next(0, 100);

            if (dice(r, c.death_rate) == 1)
            {
                day_to_dead = sick_period;
            }
        }
Exemplo n.º 2
0
        public List <CoronaPatient> infect(Random r, CoronaParameter c)
        {
            List <CoronaPatient> infect_list = new List <CoronaPatient>();

            if (this.care_level < 4)
            {
                for (int i = 0; i < contact_number; i++)
                {
                    CoronaPatient contact_p = new CoronaPatient(r, c);
                    if (contact_p.health_factor < 0.5)
                    {
                        contact_p.health_factor += 0.5;
                    }
                    contact_p.care_level     = 1;   //感染されたばかりではなにもしない
                    contact_p.serious_factor = 0.1; //発症したばかりではひどくない

                    double infect_rate = activitiy_factor * train_fator * room_factor * serious_factor * (1.0 - use_mask) * (1.0 - contact_p.health_factor) * (1.0 - contact_p.use_mask);

                    if (dice(r, infect_rate) == 1)
                    {
                        infected_number++;
                        infect_list.Add(contact_p);
                    }
                    ;
                }

                for (int i = 0; i < family_number; i++)
                {
                    CoronaPatient family_p = new CoronaPatient(r, c);
                    family_p.family_id      = id;
                    family_p.source_id      = id;
                    family_p.care_level     = 1;   //感染されたばかりではなにもしない
                    family_p.serious_factor = 0.1; //発症したばかりではひどくない
                    if (family_p.health_factor < 0.5)
                    {
                        family_p.health_factor += 0.5;
                    }

                    double family_infect_rate = room_factor * 2 * serious_factor * (1.0 - family_p.health_factor);

                    if (dice(r, family_infect_rate) == 1)
                    {
                        infected_number++;
                        infect_list.Add(family_p);
                    }
                }
            }

            this.day++;

            return(infect_list);
        }
Exemplo n.º 3
0
        public int sick_step(Random r, CoronaParameter c)
        {
            if (this.dead == 0 && day_to_dead > 0)
            {
                double care_factor      = 1.0 / this.care_level; //無視すれば一番進む
                double age_factor       = (age * age) / 10000.0; //年寄り程危ない、指数的に
                double health_factor_2  = (health_factor - 0.5) * -0.2;
                double sick_step_factor = (age_factor * care_factor) + health_factor_2 + ((r.NextDouble() - 0.5) * 0.1);
                this.serious_factor += sick_step_factor;


                //1 =何もしない 2=クリニック 3=呼吸器内科 4=入院 5=確診入院
                if (serious_factor > 0.8 && c.left_bed_count > 0)
                {
                    care_level      = 5;
                    serious_factor -= 0.1;
                }
                else if (serious_factor > 0.6 && serious_factor <= 0.8 && care_level < 4 && c.left_bed_count > 0)
                {
                    care_level = 4;
                }
                else if (serious_factor > 0.4 && serious_factor <= 0.6 && care_level < 3)
                {
                    care_level       = 3;
                    use_mask         = 1;
                    contact_number   = (int)(contact_number * 0.4);
                    activitiy_factor = activitiy_factor * 0.4;
                }
                else if (serious_factor > 0.2 && serious_factor <= 0.4)
                {
                    care_level       = 2;
                    use_mask         = dice(r, 0.6); //クリニックにいったら6割はマスク着用
                    contact_number   = (int)(contact_number * 0.6);
                    activitiy_factor = activitiy_factor * 0.6;
                }

                if (day >= day_to_dead)
                {
                    dead = 1;
                }
            }

            return(dead);
        }