I have the following code where I randomly create 7 room names, and give them a type (start, middle, end). I now need to randomly connect these rooms to each have anywhere between 3 and 6 connections. I am at a loss of what to do. I have found an example of how to do it using bitcode, but as in my other post, I still do not understand that version. If anyone could help, that would be greatly appreciated. Below is the relevant code for the rooms:
Here is where the I declare the rooms:
void createRooms(char *dir) {
//Name of rooms
char *roomNames[] = {
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j"
};
//Filenames for each room
char *filenames[] = {
"a.txt",
"b.txt",
"c.txt",
"d.txt",
"e.txt",
"f.txt",
"g.txt",
"h.txt",
"i.txt",
"j.txt"
};
int rooms[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
//Call function to write files for rooms
writeRoomFiles(rooms, dir, filenames, roomNames);
//Call function to randomly connect rooms
//Call function to categorize rooms
categorizeRooms(rooms, dir, filenames, roomNames);
}
I then want to have a function to connect these rooms, and put their connections into the .txt files created in the directory. I will also need to provide the connections later to the user, but I believe I know how to do this, since I am able to provide roomName and type already.