Esempio n. 1
0
        public void start(int ticks)
        {
            if (!ticksFinished())
            {
                return;
            }

//             if (totalTicks % 8 == 0)
//             {
//                 _conditions = _conditions.withTempearture(-60);
//             }

            _simTread = new Thread(() => {
                model.PlanetCondition conditions = _conditions;
                model.Colony colony = _currentColony;

                for (int i = 0; i < ticks; ++i)
                {
                    if (colony.isDead())
                    {
                        break;
                    }
                    SimTick tick        = new SimTick();
                    SimStep.StepRes res = tick.execute(conditions, colony);
                    conditions          = res.conditions;
                    colony = res.colony;
                    ++totalTicks;
                }

                _conditions    = conditions.withTempearture(defaultTemp);
                _currentColony = colony;
                //TODO mutate
            });
            _simTread.Start();
        }