Exemple #1
0
        public MapGenerator(int width, int height, int seed)
        {
            this.width  = width;
            this.height = height;
            grid        = new int[width * height];

            rng           = new Rng(seed);
            roomWallDistr = new DiscreteProbabilityDistribution <int>(rng, new[] {
Exemple #2
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;
 }
 public CellularAutomataRules(int range, int states, DiscreteProbabilityDistribution<int> stateDistribution)
 {
     _stateTable = Util.GetRandomInt2dArray(range, states, stateDistribution);
 }
Exemple #4
0
 public Cells(CellStructure cellStruct, DiscreteProbabilityDistribution<int> stateDistribution)
 {
     _cellStruct = cellStruct;
     _ary = Util.GetRandomInt2dArray(cellStruct.Columns, cellStruct.Rows, stateDistribution);
 }