コード例 #1
0
ファイル: Util.cs プロジェクト: chefache/Lifelike
        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);
        }
コード例 #2
0
 public CellularAutomataRules(int range, int states, DiscreteProbabilityDistribution <int> stateDistribution)
 {
     _stateTable = Util.GetRandomInt2dArray(range, states, stateDistribution);
 }
コード例 #3
0
 public CellularAutomataRules GetRandomRules(DiscreteProbabilityDistribution <int> stateTableDistribution)
 {
     return(new CellularAutomataRules(
                NeighborhoodFunction.GetRange(NeighborsCount, NumStates),
                NumStates, stateTableDistribution));
 }
コード例 #4
0
 public Cells GetInitialCells(DiscreteProbabilityDistribution <int> stateDistribution)
 {
     return(new Cells(CellStructure, stateDistribution));
 }
コード例 #5
0
 public Cells(CellStructure cellStruct, DiscreteProbabilityDistribution <int> stateDistribution)
 {
     _cellStruct = cellStruct;
     _ary        = Util.GetRandomInt2dArray(cellStruct.Columns, cellStruct.Rows, stateDistribution);
 }