Exemple #1
0
 private void IterateOverColumns(IReadOnlyList <Cell> cells, int rows, int columns, int row, Relationships relationships)
 {
     for (int column = 0; column < columns; column++)
     {
         CreateRelationship(cells, rows, columns, row, relationships, column);
     }
 }
Exemple #2
0
        private void CreateRelationship(IReadOnlyList <Cell> cells, int rows, int columns, int row, Relationships relationships, int column)
        {
            Cell cell     = cells [(row * rows) + column];
            int  position = (row * rows) + column;

            if (AddEast(columns, column))
            {
                relationships.CreateNewRelationship(cell, cells[position + 1]);
            }

            if (AddWest(column))
            {
                relationships.CreateNewRelationship(cell, cells[position - 1]);
            }

            if (AddSouth(rows, row))
            {
                relationships.CreateNewRelationship(cell, cells[position + rows]);
            }

            if (AddNorth(row))
            {
                relationships.CreateNewRelationship(cell, cells[position - rows]);
            }

            if (AddNorthEast(columns, row, column))
            {
                relationships.CreateNewRelationship(cell, cells[position - rows + 1]);
            }

            if (AddNorthWest(row, column))
            {
                relationships.CreateNewRelationship(cell, cells[position - rows - 1]);
            }

            if (AddSouthEast(rows, columns, row, column))
            {
                relationships.CreateNewRelationship(cell, cells[position + rows + 1]);
            }

            if (AddSouthWest(rows, row, column))
            {
                relationships.CreateNewRelationship(cell, cells[position + rows - 1]);
            }
        }
Exemple #3
0
 private void IterateOverRows(IReadOnlyList <Cell> cells, int rows, int columns, Relationships relationships)
 {
     for (int row = 0; row < rows; row++)
     {
         IterateOverColumns(cells, rows, columns, row, relationships);
     }
 }