Rectangles of a value in a 2d array.

BlitzMax Forums/BlitzMax Beginners Area/Rectangles of a value in a 2d array.

Ryan Burnside(Posted 2008) [#1]
This is a very difficult problem that I just can't wrap my mind around. I would be really very grateful if anyone could solve it for me. Basically I have an array in 2 dimensions.

I would like to populate the array with "blocks" of a value. These blocks will serve as rooms for a dungeon. I suppose they would have a max width and a max height.

So in our 2d array, the value 0 is a non-room square and the value 1 is part of a room block of squares. I don't need anything fancy just rectangles of the value 1 fitted inside an array.

I have a few dungeon generation algorithms I want to try but they all start with the rooms in place first. So fellows, how do I seed a 2d array with room squares?


Queller(Posted 2008) [#2]
how is this?



ugly... no error checking to make sure values are not written beyond array boundaries... but there you go.


Ryan Burnside(Posted 2008) [#3]
The problem is more packing random sized rooms into an array without overlapping. Making rectangles is not really the challange.