From: joel Date: 2001-02-05T18:10:11+09:00 Subject: [ruby-talk:10368] Re: Multi-dimensional Array Eventually, you'll need to make queries like "what objects are at the point (x,y)?" Just having a bunch of objects with x and y attributes isn't going to help much, especially if you have large maps with many objects: you'd have to search all of them to answer the query. You could use an array of arrays of arrays, with the first index being x, the second y, and the third the "stacking order" of objects at that point (assuming you want to allow several objects in the same square). An alternative is to model each cell as an object, and give it attributes that refer to adjacent cells (north, northwest, etc.), as well as an array of contents. This'll help with proximity searches ("Is there a wall in front of me?"). Another advantage of this approach is that different cells can behave differently in response to actions (trap doors, etc.). -- Joel VanderWerf skeeler@sirius.com