From: naPOLeon Date: 2006-10-23T01:05:11+09:00 Subject: []= with moredimensional Arrays Hi all, I want to code the "game of life" in ruby. I use a moredimensional array as the field and another one to provide an easy way to input the pattern of the start-population. (See the code below) So my question is, whether there is a possibility to use ar[a..b][x..y] = [[m, ...], [n, ...], ...]. That means, how can I merge two 2-dimensional arrays? size = ARGV.first.to_i field = Array.new(size, Array.new(size, 0)) thing = [[1, 1, 0, 1], [1, 0, 1, 0], [0, 0, 1, 0], [1, 1, 0, 0]] pos_x, pos_y = size/2, size/2 field[pos_x..(pos_x + thing.length)][pos_y..(pos_y + thing.length)] = thing Thanks, naPOLeon