Beispiel #1
0
 public CellInfo[] Evolve()
 {
     var nc = rnd.Next(1, 8);
     var cells = new CellInfo[nc];
     for (int i = 0; i < nc; i++)
     {
         int r = rnd.Next(0, RowCount);
         int c = rnd.Next(0, ColCount);
         grid[r,c] = !grid[r,c];
         var cell = new CellInfo { Row = r, Col = c, Live = grid[r,c]};
         cells[i] = cell;
     }
     OnCellsChanged(new GridCellsChangedEventArgs { Cells=cells});
     return cells;
 }
Beispiel #2
0
 private void UpdateCellsChangedView(CellInfo[] cellsChanged)
 {
     foreach (var ci in cellsChanged)
         UpdateCellView(ci.Row, ci.Col, ci.Live);
 }
Beispiel #3
0
 public void ChangeCell(int row, int col)
 {
     grid[row, col] = !grid[row, col];
     var cells = new CellInfo[] { GetCellInfo(row, col)};
     OnCellsChanged(new GridCellsChangedEventArgs { Cells = cells});
 }