Exemplo n.º 1
0
Arquivo: Row.cs Projeto: khanhl/GoL
 /// <summary    >
 /// Add a cell into the row
 /// </summary>
 /// <param name="cell"></param>
 public void AddCell(Cell cell)
 {
     Cells.Add(cell);
 }
Exemplo n.º 2
0
Arquivo: Row.cs Projeto: 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);
 }
Exemplo n.º 3
0
Arquivo: Grid.cs Projeto: 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;
 }