I've been slowly learning Ruby (at this point, maybe the first language I've invested any amount of time in actually learning) so this is probably going to be a very simple question for many of you.
My toy project for my studies is, basically, a roguelike. Currently, I have a Map class that contains an array of Tile objects representing, of course, each tile in the entire map. I'm attempting to create a method that will return a smaller array (most likely example would be to display the currently viewable area of the map).
My problem comes down to this. Since the array containing all these tiles is single-dimension, I can't seem to think of a clean way to slice pieces of this array out based on two x,y coordinates that the method takes to determine what to return. In other words, I can't seem to find a clean way to translate between the two coordinate pairs without some fairly ugly looking code and I get the idea that there's a very simple way to do this that is just not 'clicking'.
Ideas anyone? I'm open to some pretty crazy suggestions!