essentially, i am gonig to have an arena(represented by a matrix aka multidimensional array) composed of land and water. what i need is an algorithm that makes all of the land connected and guarantees that at least 70% of the total area is land.
this is probably really easy, but i am a programming noob
Does the land have to be random?
One way that I would do it would be to create "water seeds" that expand out then check if the land is connected everywhere and if not, find the closest points on two seperate land masses and connect them. By the way, what language?
I would do the opposite, and have a 'land seed', so that i didnt have to check to see if all the land was connected
java(no language bashing
, its for school)
i am creating the 'arena' from scratch so i figured i would use something similiar to a random maze algorithm(i can't use that because i don't want skinny paths).
yes, the land should be random.
I agree with the land seeding. Start out with all water, add a random point for land. Then, connect all the land. Then, check the percentage of land(if it isn't already connected). Repeat until you have 70% land. If you need it to be from 70 - 100, just use another random number for the percentage.
QUOTE
java(no language bashing
, its for school)
Tell you what, there are any elitists around who want to pwn pr0gr4mm1ng n00bz w/ their l33t $k1llz, leave off poor Zeratul_101 here and attack me instead. I love programming, but knowing only Excel 4.0, TI-Basic and a little Javascript I'm sure I'd be very satisfying as some worthless scripter dirt for you guys to insult and feel superior to.
Nuvzz0rz, Ti-Basic is 4 t2h n00bz0rz. Overall, I agree. It's easier to start with default and put what you need later. Connecting it, of course.
go with one or more land seeds which expand randomly until n% is covered, should be fairly simple to do
well, the thing is, i don't want to end up getting stringy 1 unit-wide strips of land. how certain is it that this wont happen?
Make sure the size of the matrix is smaller than the needed amount for 70% land. For example, if you want a land with 7 squares, make the lengths 3.
okay, the land-seed idea works, not as random as i would like it, but its good enough. thanks guys