Engr 692: Special Topics in Engineering Science
(Ruby and Software Development)
Fall 2006

Assignment #2
Due 4:00 p.m., Monday, 2 October 2006


Note: This exercise is based on a practice programming problem used at the ACM Southeast Regional programming contest a few years ago.

Bingo is a popular game played on a 5 by 5 grid, called a card. Normally we associate each column of the card with the letters B-I-N-G-O from left to right. Each square on the grid has a number in it. As numbers are selected, they are marked off the card. When a line of five squares, horizontal, vertical or diagonal, is marked out, the card is a winner. When a player gets a winning card, he or she shouts BINGO!

A sample bingo card is shown below:

B

I

N

G

O

12

28

31

49

66

3

26

45

53

75

10

17

33

59

67

7

19

42

55

74

2

23

37

46

70

If the numbers 3, 45, 53, 75, and 26 are picked, then there will be a horizontal bingo on the second row.

The five entries in a column are random integers in the range selected from the ranges indicated below:

There are no duplicate values on a card.

The goal of this assignment is to design and implement a Ruby program to play a game of bingo.

Comments

This is not a particularly difficult assignment. My purposes are:

Note that I do want the classes and methods specified using preconditions, postconditions, and invariants.

If any of you are looking for more of a challenge, you might think about developing the program, in particular the BingoCard and GameCards classes, as an "application framework" for a whole class of Bingo-like games. By application framework, I mean a set of abstract base classes, interfaces, and concrete library classes that can be extended, implemented, or used to provide different specific games. The set of classes making up the framework represent the common aspects of the family of programs. The extensions represent the variable aspects of the family. Here are some ideas--perhaps all cannot coexist within the same design.

Don't try something sophisticated until you are sure you can deliver a good solution to the basic problem

Finally, if you have a programming problem you would like to tackle, then let me know. I could perhaps substitute it for this one, but more likely I might consider it for future individual or group programming exercises.


UP to Engr 692 Assignments page?


Copyright © 2006, H. Conrad Cunningham
Last modified: Wed 20 Sep 2006