From: vanjac12@... (Van Jacques) Date: 2003-12-01T21:27:06+09:00 Subject: Re: ruby game of life program "Josef 'Jupp' SCHUGT" wrote in message news:<20031129174431.GB2320@jupp%gmx.de>... > #!/usr/bin/env ruby > N = 7 > > tos = Array.new > tng = Array.new > > 0.upto(N) { |row| > tos[row] = Array.new(N+1) > tng[row] = Array.new(N+1) > tos[row] = [0, 0, 0, 0, 0, 0, 0, 0] > tng[row] = [0, 0, 0, 0, 0, 0, 0, 0] > } > ... > Wow, that was my first game of life ever :-> > > Josef 'Jupp' Schugt One thing I notice was that I used a = Array.new b = Array.new 0.upto( size - 1 ) do |i| a[i] = Array.new(size, 0) b[i] = Array.new(size, 0) end while you used tos = Array.new tng = Array.new 0.upto(N) { |row| tos[row] = Array.new(N+1) tng[row] = Array.new(N+1) tos[row] = [0, 0, 0, 0, 0, 0, 0, 0] tng[row] = [0, 0, 0, 0, 0, 0, 0, 0] } ========== Is there any difference? It seems easier to use tos[row] = Array.new(N+1, 0) rather than tos[row] = [0, 0, 0, 0, 0, 0, 0, 0] . Van