Alright, I think I got that idea planed out for when I code it up, now for the current problem at hand.
I have a bunch of "cities", if they aren't next to each other, I want there to be a road linking them, and for all the cities to be linked up in a chain of roads.
So, lets say you have a 40x40 grid. In it, are an arbitrary amount of points, you have one maybe at (0,0), anther at (0,1), one at (39,39), one at (24,14), ect.
Does anyone have an idea of an algorithm I could use?
My current idea is to first parse the grid for all cities, then start doing a number of paces of the list to see if a city has anther city within i units. First check if there is one 1 space away, then go down the list and check for 2, then 3, ect. If it finds a pair (Or more), take them out of the list, and put them in some sort of objects and list to keep track of them, saying "Ok, put a road between these two". Then, I need to try and link up the segments of roads together. So, I will go down the list of roads find which two have the two shortest points to each other, and link them. Then, put it back into the list, and keep doing so till there is one one object.
Does this sound reasonable? I am not sure if it would even work right.