Ejemplo n.º 1
0
        public Field(int width, int height, ICellArray cellArray)
        {
            Height = height;
            Width  = width;

            border = true;

            // Стартовая плотность.
            Density = 0.3f;

            {
                nearestCellsLocation[0].X = -1; nearestCellsLocation[0].Y = -1;
                nearestCellsLocation[1].X = -1; nearestCellsLocation[1].Y = 0;
                nearestCellsLocation[2].X = -1; nearestCellsLocation[2].Y = 1;
                nearestCellsLocation[3].X = 0; nearestCellsLocation[3].Y = -1;
                nearestCellsLocation[4].X = 0; nearestCellsLocation[4].Y = 1;
                nearestCellsLocation[5].X = 1; nearestCellsLocation[5].Y = -1;
                nearestCellsLocation[6].X = 1; nearestCellsLocation[6].Y = 0;
                nearestCellsLocation[7].X = 1; nearestCellsLocation[7].Y = 1;
            }

            ListActiveCells = new List <Cell>();
            NewListCells    = new List <Cell>();

            ListCellsForDraw = new List <Cell>();

            field = cellArray ?? new CellArray(width, height);
        }
 private void CompareCellArrays(ICellArray expected, ICellArray actual)
 {
     Assert.That(actual, Is.Not.Null);
     Assert.That(expected.Dimensions, Is.EqualTo(actual.Dimensions));
     for (var i = 0; i < expected.Count; i++)
     {
         CompareMatArrays(expected[i], actual[i]);
     }
 }