Exemplo n.º 1
0
        public LookUpCA() : base()
        {
            parameters = new CAParameters(NeighbourHoodSize: 3,             //above three is just "almost" supported currently
                                          CellStateCount: 2,
                                          CellWorldWidth: 25,
                                          MaxGeneration: 25);

            MakeStates(parameters.CellStateCount);

            seed = new float[] { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

            if (seed.Length != parameters.CellWorldWidth)
            {
                throw new FormatException("seed not compatible with experiment parameters");
            }

            cells = new OneDimCell[parameters.CellWorldWidth];
            for (int i = 0; i < parameters.CellWorldWidth; i++)
            {
                cells[i] = new OneDimCell(i, cells, parameters.NeighbourHoodSize);
            }
            foreach (BaseCell cell in cells)
            {
                cell.InitializeNeighbourhood();
            }
        }
Exemplo n.º 2
0
        public Test1DimCA() : base()
        {
            parameters = new CAParameters(NeighbourHoodSize: 3,
                                          CellStateCount: 2,
                                          CellWorldWidth: 5,
                                          MaxGeneration: 40);

            MakeStates(parameters.CellStateCount);

            //seed = new float[] { 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 };
            //goal = new float[] { 0, 1, 1, 0, 1, 1, 0, 1, 1, 0 };
            seed = new float[] { 0, 0, 1, 0, 0 };
            goal = new float[] { 0, 1, 1, 1, 0 };

            if (seed.Length != parameters.CellWorldWidth ||
                goal.Length != parameters.CellWorldWidth)
            {
                throw new FormatException("seed not compatible with experiment parameters");
            }

            cells = new OneDimCell[parameters.CellWorldWidth];
            for (int i = 0; i < parameters.CellWorldWidth; i++)
            {
                cells[i] = new OneDimCell(i, cells, parameters.NeighbourHoodSize);
            }
            foreach (BaseCell cell in cells)
            {
                cell.InitializeNeighbourhood();
            }
        }