Пример #1
0
Файл: Row.cs Проект: khanhl/GoL
 /// <summary    >
 /// Add a cell into the row
 /// </summary>
 /// <param name="cell"></param>
 public void AddCell(Cell cell)
 {
     Cells.Add(cell);
 }
Пример #2
0
Файл: Row.cs Проект: khanhl/GoL
 /// <summary>
 /// Insert a cell into specified index position
 /// </summary>
 /// <param name="index"></param>
 /// <param name="cell"></param>
 /// <param name="count"></param>
 public void InsertCell(int index, Cell cell, int count)
 {
     if (index < 0 || index >= count) throw new ArgumentOutOfRangeException("Invalid Index value: must be greater than zero and less than Column count");
     Cells.Insert(index, cell);
 }
Пример #3
0
Файл: Grid.cs Проект: khanhl/GoL
 /// <summary>
 /// Setup grid by using row and column count
 /// </summary>
 /// <param name="rows"></param>
 /// <param name="columns"></param>
 private void Setup(int rows, int columns)
 {
     if (rows <= 0 || columns <= 0) throw new ArgumentOutOfRangeException("Row and Column size must be greater than zero");
     GridObj = new List<Row>();
     for (int i = 0; i < rows; i++)
     {
         Row row = new Row();
         for (int j = 0; j < columns; j++)
         {
             Cell cell = new Cell(false);
             row.AddCell(cell);
         }
         GridObj.Add(row);
     }
     ColumnCount = columns;
 }