Hi All,

Beginning programmer (and beginning Ruby programmer) here... First off,
I wanted to say that Ruby's (and the Pragmatic Programmer's Ruby book)
has been great, not only to program in, but to learn basic concepts as
well.  I was learning through Java previously, but many concepts, such
as Arrays, Hash Tables, and the Singleton Method came to me very
quickly.

Anyways, I wanted to start off by making some very simple games.  So,
I'm going to start with a mapreader class. I thought I could start by
reading in a text file, with x's to denote walls.  So, I'm thinking I
would need to store the x, y, and type of object (wall, monster,
treasure, etc.) in the array, and thought that a multi-dimensional
array would keep all of the data in good order.

A typical map might look like

xxxxxxxxxxxxxxxxxxxx
x                  x
x                  x
x            H     x
x                  x
x      M           x
x                  x
xxxxxxxxxxxxxxxxxxxx

M = monster h = hero
I'd also want to add more complexity later ( IE, mazes etc.)

So the question is,

a. Is a multi-dimensional array the best way to track this information?
b. Does Ruby have support for it?
c. Is there a better way to keep the information?

Thanks in advance,

Jason


Sent via Deja.com
http://www.deja.com/