|
03/10/03: Progress Report #8Plan As I mentioned a couple of daily logs ago, I've decided to quit focusing so much on getting video and focus on getting some coding done instead. Therefore, although my goal is to get two more video clips during this iteration, I'm not going to focus on it. That leaves the main goal of this iteration: figuring out a way to put the exhibits up in the correct rooms of the museum. I think that's going to be my biggest challenge, so I don't know how long this iteration will last. Design This iteration of my project will be mostly design. I had already come up with an naming convention for the exhibits, which was one of the goals of an earlier progress report. For this iteration, I had to figure out a way to use that naming convention to put the exhibits in their correct sections and subsections (wings and rooms). And after that, there was the major problem of how to space the exhibits reasonably on the walls of the room in which it belonged. I decided to tackle the second problem first. I thought that if I had a list of all the spaces of empty wall in each room, I could sort the list in order of largest wall space to smallest wall space. Then, whenever the program read in a new exhibit, it would merely find the room to which the exhibit belonged, take the largest wall space, put the exhibit in the middle of that wall space, split the former largest wall space into two equal parts, and sort those two equal parts back into the list. With this part of the design figured out, I skipped coding it and instead went back to the first problem: how to organize this increasingly complex procedure. I knew that I needed some sort of organizational structure that contained several layers. First, the program would have to check the first four characters of the file name to match it with the proper section. Then, it would have to check the four subsection characters against however many subections were in the section. (There's not a uniform number of subsections per section, so this was another complication.) Finally, the program would have to rearrange the list of wall spaces, which was also not a uniform number. Therefore their were three necessary layers to the organizational structure: the sections layer, the subsections layer, and the list of wall spaces. What I came up with included three different types of structures, arrays, pointers, and linked lists, but I think it's as simple as it can possibly be. There are three types of structs. The first struct is the section struct: it contains the four-character array that the program uses to match the exhibit with its section and a pointer to the second type of struct. The second struct is the subsection struct: it contains the four-character array that the program uses to match the exhibit with its subsection as well as a pointer the third type of struct. The third type of struct is the wall space struct: it contains four floating numbers which are the x- and z-coordinates of the two endpoints of each wall space and, of course, a pointer to the next wall space struct. Of course, these are not really layers yet, so the structs must be put into arrays. The first type of struct, the section struct, is put into an array of four structs for each of the four sections. Each of the four section structs has a pointer that points to an array of the second type of struct, the subsection struct. Finally, each of these subsection structs has a pointer to the largest wall space struct in that subsection. And each wall space struct points to the next smallest wall space struct in the subsection until the last wall space struct, which points to NULL. I only had time to initialize this organizational structure for this iteration because I spent most of the time diagramming the structure. However, the diagram is complete with the variables of each struct and can be seen below (as always, you can click on the picture for a larger image): Also during this iteration, using the diagram I made, I created the text file that the program is going to input in order to create this whole complicated structure, which is going to be the goal of my next iteration report. Coding Download the code for this iteration: report08-museum.cpp The following text file was also created for this iteration: wallspace.txt Testing There is no testing available for this iteration of the program.
|