def generate(study, &block)
      adapt_for_single_method if study.method == :single
      block.call(0, @grid)
      1.upto(study.generations) do |cell_index|
        apply_rule(study)
        block.call(cell_index, @grid)
      end
    end
def generate(study, &block)
      adapt_for_single_method if study.method == :single
      block.call(0, @grid)
      1.upto(study.generations) do |cell_index|
        apply_rule(study)
        block.call(cell_index, @grid)
      end
    end
Public: Generate successive generations of this automaton.
 If, for example, `student.generations == 4` then #generate will
 produce 5 generations: The original generation plus the four you
 want.

 study - Study instance.
 block - What to do with a generation.

 Example

    automaton.generate(study) do |num, generation|
      printf "Gen %4s: %s\n", num, generation.join()
    end
    # => will result in something like that:
    # => Gen    0: 0101001010001011000001000100000100101011
    # => Gen    1: 0000010000010000000010001000001001000000
    # => Gen    2: 0000100000100000000100010000010010000000
    # => Gen    3: 0001000001000000001000100000100100000000
    # => Gen    4: 0010000010000000010001000001001000000000

 Returns successive generations as Array.