A Random Sea
hi,
im currently studying algorithms and am hoping to create a very simple program that makes a random sea. i have having some trouble with it however - i know what i want to do but not sure exactly how to do it.
Currently i have a grid of squares ( 8 by 8 - using an array), all classed as land, and these are called square1 ...square 64. At this stage i want to make 10 squares "ocean".
1) the program randomnly picks on of the outer squares,
2) this is where i am at now. Something i could use is as follows:
Final int TotalOceanCount = 10;
for (int OceanCount = 0 ; OceanCount < TotalOceanCount ; OceanCount++) {
....
i am stuck on the next area. what i want to do is this:
***Choose a random square that touches a current Ocean square and convert it from Land to Ocean*** Using the above loop will limit the number of Ocean squares to 10.
Does anybody have suggestions on what topics i should look at in order to be able to complete this simple problem? im guessing the solution is basic and would be a few lines long, but a few lines is a lot of lines if you dont know where to look :-)
thankyou in advance,
Mark Scott

