Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var amoeba = new AmoebaActor();

            resultActor = new ResultActor();
            amoeba.Launch(resultActor);
        }
Beispiel #2
0
        public void Launch(ResultActor resultActor)
        {
            MonteCarloActor <long> .Cast((simnum, iteration, result) =>
            {
                if (iteration <= 0)
                {
                    return;
                }
                Random random   = new Random((int)simnum);
                long population = 1;
                for (long i = 0; i < iteration; i++)
                {
                    long newPopulation = 0;

                    for (long p = 0; p < population; p++)
                    {
                        newPopulation += random.Next(4);
                    }
                    population = newPopulation;
                    if (population <= 0)
                    {
                        break;
                    }
                }
                result.SendMessage(population);
            }, 30, resultActor, 100000);
        }