On May 21, 9:26 am, "doug meyer" <doug.me... / sigeps.org> wrote:
> Hey,
>    Did anyone else run into the problem of trying to setup your square using:
> Array.new(size, Array.new(size))
> that was annoying! And I wasted too much time with formating the output.

If you're talking about the problem I think you're talking about,
that's the reason I dismissed that approach out of hand.

irb(main):001:0> x = Array.new(5, Array.new(5,0))
=> [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0,
0], [0, 0, 0, 0, 0]]
irb(main):002:0> x[2][2] = 5
=> 5
irb(main):003:0> x
=> [[0, 0, 5, 0, 0], [0, 0, 5, 0, 0], [0, 0, 5, 0, 0], [0, 0, 5, 0,
0], [0, 0, 5, 0, 0]]

Those references will get you if you're not careful.

--
-yossef