CS199 Computer Science for Beginners  -  Spring 2009

Exercise 6    Due: Thursday, May 28, 2009 at Midnight

See below for instructions about which Python programs you need to send me by e-mail.

Be sure to name your files: Smith-2.py (if your last name was Smith and you were submitting exercise 2).  Etc.

Be sure to put comments in your program at the beginning that include your name, the Programming Exercise number, and a brief description of what your program does.  Put comments throughout your program to indicate what is happening.  Use informative names for your variables and your functions.

Be sure that your program responds appropriately for the full range of inputs.  (For example, if your program is not designed to accept negative numbers, check and make sure that the numbers you receive are NOT negative and print out an appropriate error message.)

Remember: my e-mail address is lmd with the “at” symbol followed by cs.pdx.edu.

Programming assignment:

You are to turn in:

1.       A document that describes your design for your program, with a brief description of why you chose to design it the way you did.  You should include a structure chart, such as the one shown on page 278.  (You can also include two or more structure charts to show how your design evolved.  That is, you could show me your initial structure chart, and then more detailed structure chart.  You can also include a structure chart and/or a description of other designs that you considered.)

2.       A data file, with the input data on one Bingo card.

3.       Your program (with the proper file name and documentation, as described above).

The program that you will write will be one player in a Bingo game.  Your program will read in the Bingo card (from the first input file).  You will need to store the program in some sort of data structure, inside your program.  Your program will then read each “called” item.  If the item is present on the Bingo card, you need to mark it in some way – so that you know it is covered.  After each “called” item is processed, you need to check and see if you have a “Bingo.”  That is, you need to check and see if you have won the game.

You can generate a Bingo card (and thus get data that describes your bingo card) from the following website: http://www.dltk-cards.com/bingo/bingo7.asp

You should generate a random “call” (which consists of a column (B or I or N or G or O) and a number.  (Note that not all numbers can occur in each column.  Use the above web site to generate a “call sheet” to see the complete set of numbers.)  For each call, print out the call, and then check to see whether you can mark your Bingo card.  Every time you are able to mark your Bingo card, you should check to see whether you have won the game.  You win a Bingo game by marking every spot in one row, or one column, or one diagonal.  When you win a game, print out your Bingo card with every marked spot indicated.  Note: we should still be able to see the numbers on your card, even if they are marked.  Please print out the Bingo card so that it looks (at least somewhat) like a real Bingo card.  You should indicate the spots that go together to constitute the win – when you print out your Bingo card.