Exemple #1
0
 protected override void InitializeGrid(byte Rule, IList <Coords> InitialSeeds)
 {
     for (YUpdatePos = 0; YUpdatePos < Height; YUpdatePos++)
     {
         for (XUpdatePos = 0; XUpdatePos < Width; XUpdatePos++)
         {
             CellGrid[XUpdatePos][YUpdatePos] = new WolframCell(GetNeighborStates, Rule, GetCellStartingState(InitialSeeds));
         }
         XUpdatePos = 0;
     }
     YUpdatePos = 0;
 }
        public void InstantiationStringTest()
        {
            const string rule         = "10101010";
            const byte   initialState = 1;
            const byte   Expected     = initialState;

            WolframCell cell = new WolframCell(GetNeighbors, rule, initialState);

            byte result = cell.GetState();

            Assert.AreEqual(Expected, result);
        }
        public void RuleTest()
        {
            const string rule         = "10000000";
            const byte   initialState = 0;

            const byte expected = 1;

            WolframCell cell = new WolframCell(GetNeighbors, rule, initialState);

            cell.Update();
            byte result = cell.GetState();

            Assert.AreEqual(expected, result);
        }