M
Matthew Margolis
@tileArray = Array.new()
@height.times {@tileArray.push Array.new(@width, Tile.new)}
I was hoping that the above code would create a 2D array filled with
Tile objects.
In Tile#initialize I have the simple line puts "orange"
When I run the code only #{height} "orange"s are printed to the
terminal. I assume that my code is only creating one Tile object per
row, how would one go filling the 2D array with unique Tiles?
Thank you,
Matthew Margolis
@height.times {@tileArray.push Array.new(@width, Tile.new)}
I was hoping that the above code would create a 2D array filled with
Tile objects.
In Tile#initialize I have the simple line puts "orange"
When I run the code only #{height} "orange"s are printed to the
terminal. I assume that my code is only creating one Tile object per
row, how would one go filling the 2D array with unique Tiles?
Thank you,
Matthew Margolis