CIS 1057 Sections 1 and 3 Fall, 2008 Homework 08: Bingo Game Structural Design Due: In class, no later than Wednesday, Nov 19 (Sec 003) or Thursday, Nov 20 (Sec 001) (Email to ME not the lab assistant. Keep a copy for yourselves. You will need it for all later stages of the project.) This assignment relates to the Bingo Game software that we will be writing over the next few weeks. NOTE: Remember, at the beginning of the semester we talked about how there was much more to learn in this course than just writing C programs. So far during the semester, we stressed the idea that every program consisted of a model of data (structs, arrays, and primitive data types such as float, int, and char in the case of C) to be manipulated, and processes (functions in the case of C) to carry out these manipulations. We worked on the design of a number of simple problems by identifying the data to be processed and the functions to do this processing. However, the problems we worked on were small, as were the programs we wrote, so in many ways, life was good! Bingo is different. It is a comparatively larger project, requiring far more attention to data and process modeling than we have done until now. Therefore: I do NOT expect nor want anyone to be writing any code at this point. We have lots of other things to learn before any code gets written. What You Should Learn from the Bingo Project: You will learn 1) more about how to manipulate data stored in structs, arrays, two-dimensional arrays, 2) how to do external file I/O, 3) how to do detailed input validation; 4) how to manipulate “Boolean” data in C; and 5) how to define and manipulate data in complex structures with more complex algorithms. You will also see first hand what a more complex piece of software looks like and how failure to tend to each and every piece of detail in a program will cause problems later in the life of the software product. You will also learn a little about writing test drivers for functions before the functions are inserted into your code. Finally, you will learn a bit about the choices that programmers and system designers make everyday when it comes time to decide exactly how they will represent data in the computer and how they will process this data. You will see how some choices are better than others, and how the data representation choices almost always affect the processing that has to be carried out as well. In the end, this is all about modeling. Your program has to model the data and the processes (steps) involved in playing the game of BINGO and required to produce a Bingo Game program. The hard part of course, is to be able to document, step-by-step, detail-by-detail the algorithms you need to use in designing your game simulation program. Oh Yes, One Other Thing You Will Learn: The Bingo game is a large project compared to all the other work you have done thus far. It therefore requires special attention to the details of problem analysis and decomposition. We have seen some examples of such decomposition for smaller problems such as the Simple Statistics Problem and Lab08R, both of which involved functional decomposition – a software design approach in which functions are used as the basic decomposition component of a larger software project. In our view, the Bingo Game is a larger, more complex, and more challenging project – one that can benefit from a somewhat different approach. Specifically, we focus first on a data-driven decomposition, partitioning the program into 5 components, four of which are primarily based on the important data abstractions required. Our goal is to provide abstract models for each of these data entities and implement these models in separate C components called Modules, which contain both the data stores and constants required for each model plus a set of methods (functions) that operate on these data stores, modifying them in some cases, and in others, simply examining the current content (state) of these stores. For our Bingo Game, we have selected four abstract entities to model: 1. The Bingo Board (or card) itself 2. A list of Called Numbers (used to actually carry out the call of the next letter and number) in a “pseudo” random manner and to keep track of numbers called so as to avoid duplicates. 3. A Random Number Generator which actually produces “random” values to be used in initializing Bingo cards and in playing the game. 4. A Block Character entity which is used to store and display in block form each actual letter and number that is generated These four components, combined with a main program, form the partition of the Bingo program into smaller, more easily managed components. We will give you the code for the Random Number Generator and the Block Character components (you have seen most of them already). You have also written part of the main program. We will also give you the data stores to be used for each component and a list of the methods (functions) required to implement each component. You will be asked to use what we give you as the basis for the development of your Single Card Bingo Game. I am afraid that time will not permit us to work with multiple cards, although that would be a logical extension of the work you will do. The code you will need will be posted on the Board for your class. For Stage 3 of this project, the Implementation Phase, you will need to use this code and complete the project. However, for the first two stages of this project, you just need to READ this code and write out appropriate comments. No coding is required or desired. Instead, we will work diligently on design. 1. First, the design of the overall structure of the program and its data stores and functions 2. Second, on the design of the algorithms required to carry out the processing required for each data abstraction Homework Assignment (Stage I – Structural Design): Examine the code that is on the Board. You will find all the .h files needed for this project as well as some of the .c files. We will review some aspects of the main program as well as most of the Block Characters and Random Number Generator .h and .c modules. After examining the .h files for the Board and the Called Numbers modules, complete the documentation for the prototypes of the methods (functions) listed in these files. If you are not completely sure what each method is to do and what its arguments are about, you need to ask now. You should not be writing any of these functions if you cannot clearly document the prototypes. Your documentation for each function should look something like this: /* * Function Name: printBlock * Parameters: char - the letter to be printed (either B, I, N, G, or O) * int - the number representing the tens digit (numbers 0 - 9) * int - the number representing the ones digit (numbers 0 - 9) * Returns: void * * This function will print out a single character (a letter) followed by 5 * spaces and then the number for a bingo space. The number is broken up * into two numbers, the tens digit and the ones digit. */ void printBlock(char letter, int tens, int ones); Note that the argument names may or may not be attached to the prototypes.