Пример #1
0
        public override void Initialize()
        {
            base.Initialize();

            this.stateCount = 2;

            this.states = new long[stateCount];
            for (int i = 0; i < stateCount; i++)
            {
                this.states[i] = IndexToState(i);
            }

            CellularAutomataInitializationData initData = new CellularAutomataInitializationData(0, CELLS, true, NeighbourhoodMode.Moore);

            Init(initData);

            Random random = new Random(Seed);

            this.stateColors = new Color[stateCount];
            for (int i = 0; i < stateCount; i++)
            {
                this.stateColors[i] = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
            }
            this.stateNames = new string[stateCount];
            for (int i = 0; i < stateCount; i++)
            {
                this.stateNames[i] = "State " + this.states[i];
            }
        }
Пример #2
0
        public override void Initialize()
        {
            base.Initialize();

            //ResourceManager.RegisterResourceLoader(new CellularAutomataStateLoader());

            //ResourceManager.LoadResource<CellularAutomataInitializationData, CellularAutomataStateLoadingParameters>(
            //    "CAStateData",
            //    new CellularAutomataStateLoadingParameters(new [] {FILE_PATH}), 0, false);

            //ResourceManager.GetResource("CAStateData", out CellularAutomataInitializationData initData, true);

            //CellularAutomataInitializationData initData = CellularAutomataStateLoader.Load(SavePath, new CellularAutomataStateLoadingParamyeters(new[] { FILE_PATH }));
            CellularAutomataInitializationData initData = new CellularAutomataInitializationData(0, CELLS, true, NeighbourhoodMode.Moore);

            Init(initData);
        }