Memory


In this assignment, you will write or extend a program in C that implements an interactive game, simulation, story, calculator, or conversation.

Requirements

Your program must use input and output to files and dynamic memory. Use fopen to open one or more files, and use the library functions that enable you to read and write files. You may choose whichever functions are most convenient for your purposes, e.g. fgets/fputs, fscanf/fprintf, and fread/fwrite. Your program must also use dynamic memory, i.e. malloc and free (you may also use the m conversion specifier to scanf).

Other than that, your program may perform any task, similar to the Interactivity assignment. You may extend your program from that assignment, using file I/O and dynamic memory to implement some kind of configuration or saved state, or you can write a new program based on another idea.

Submit your work in the form of a .tar.gz archive that unpacks to contain a directory with the same name as the archive with the extension removed. All of your files must be in that directory, including a Makefile such that make or make all builds your program, and make clean deletes any files produced by the build. If you want, there may also be a text or pdf file that describes your program and anything a user might want to know about how to use it. Files you create that your program needs to exist when it runs (e.g. so it can read from them) should also be included in the archive.

Remember, no matter how easy or difficult you think your idea will be for you to implement, start out so easy it's trivial and add functionality slowly but surely. That way, an ambitious idea that you can't quite achieve results in a working program that does less than you'd hoped, rather than a broken program. Any program that can build and run without crashing and meets the requirements above counts for fulfilling the learning outcomes of the assignment.

Sources of ideas

You may base your idea on a description or code you find, and even refer to existing source code to guide the design of your work, but in the end you must set other material aside and write your own program. If you use any found material in any way, you must cite it. Citations can appear in the source code in comments, or collected in another file in your project directory. You may use any citation format, as long as it includes the title (if applicable), author, and a reference such as a link that is sufficient for somone else to find a published copy of the work. You might also include a brief description of how you used the source.