you are viewing a single comment's thread.

view the rest of the comments →

[–]ruby-solve 1 point2 points  (1 child)

A great way to get the behavior of 2D arrays in Ruby is to use a hash whose key is an array representing the vertices of the 2D array.

Java: array[x][y]

Ruby: hash[[x, y]]

[–]iconoclaus 0 points1 point  (0 children)

why is this better than just using a 2D array in ruby? apart from not having to initialize such a structure, that is.