Beispiel #1
0
        public void step()
        {
            Cell cell;
              int neighbours;
              string output = "";
              string[,] updatedBoard = new string[height,width];

              for (int y = 0; y < height; y++) {
            for (int x = 0; x < width; x++) {
              neighbours = countNeighbours(y, x);
              cell = new Cell(board[y,x], neighbours);
              cell.live();
              output += cell.getState();
              updatedBoard[y,x] = cell.getState();
            }
            output += "\n";
              }

              board = updatedBoard;
              Console.WriteLine(output);
        }