Esempio n. 1
0
        public static int[,] GetRandomInt2dArray(int cols, int rows, DiscreteProbabilityDistribution <int> stateDistribution)
        {
            var ary = new int[cols, rows];

            for (int row = 0; row < rows; row++)
            {
                for (int col = 0; col < cols; col++)
                {
                    ary[col, row] = stateDistribution.Next();
                }
            }
            return(ary);
        }
Esempio n. 2
0
 public CellularAutomataRules(int range, int states, DiscreteProbabilityDistribution <int> stateDistribution)
 {
     _stateTable = Util.GetRandomInt2dArray(range, states, stateDistribution);
 }
 public CellularAutomataRules GetRandomRules(DiscreteProbabilityDistribution <int> stateTableDistribution)
 {
     return(new CellularAutomataRules(
                NeighborhoodFunction.GetRange(NeighborsCount, NumStates),
                NumStates, stateTableDistribution));
 }
 public Cells GetInitialCells(DiscreteProbabilityDistribution <int> stateDistribution)
 {
     return(new Cells(CellStructure, stateDistribution));
 }
Esempio n. 5
0
 public Cells(CellStructure cellStruct, DiscreteProbabilityDistribution <int> stateDistribution)
 {
     _cellStruct = cellStruct;
     _ary        = Util.GetRandomInt2dArray(cellStruct.Columns, cellStruct.Rows, stateDistribution);
 }