CS 117 Final Project
Due 5:00 PM Wednesday, 6/10/98


For your final project, you will write one of the four programs described below. You will work alone for this project. This does not mean that you shouldn't talk with each other and lab assistants about your project. It does mean that the bulk of your code should be your own, and that any assistance you receive from others should be acknowledged in the comments and documentation accompanying your code.

I: Poker Hand Probabilities

Many decks of poker cards include a card showing the probabilities of being dealt various types of 5-card hands. For example, the probability of being dealt a royal flush (Ace, King, Queen, Jack, and Ten, all the same suit) is 1 chance in 649740, or approximately .000001539. If you select this project, your job will be to write a program that approximates the probabilities listed on such a card.

To do this, your program will generate a large number (many millions) of poker hands, and count the number of royal flushes, flushes, straights, full houses, etc. included among those hands. This means that you will need to figure out how to generate a random poker hand, and then how to determine what type of hand it is.

Your program should report probabilities for each of the following types of hands. The term "rank" refers to the card's numerical or letter value.

II: Moveable Movies

If you choose to do this project, you will write a program that uses the Carleton Graphics Library to display a short movie. The content of your movie is up to you, but it need not be complicated (in fact, you should probably avoid excessive complication so as to preserve your finals week sanity).

There's a catch, though. Your code should be organized so that the movie can be shown in a frame of any size or location. In particular, your code should include a function described as follows:


	//
	//	DrawFrame
	//
	//	Draws the Nth frame of the movie inside the rectangle
	//	the coordinates of whose top, bottom, and sides are
	//	given by the parameters top, right, bottom, and left.
	//	Note that no drawing is done outside this rectangle,
	//	and that no assumptions are made about the width, height,
	//	or ratio of width to height of the rectangle.
	//	
	
	void DrawFrame( int N, int bottom, int left, int top, int right );

There are lots of cute tricks you can play with your movie if you organize the code in this way. For example, you could show the movie in two locations on the screen simultaneously by doing something like this:


	for( int i=0; i < nFrames; i++ )
	{
		DrawFrame( i, 0, 0, 200, 200 );
		DrawFrame( i, 300, 300, 500, 500 );
	}

Or you might show all the frames simultaneously in one window, lined up in a grid so you could compare all the frames at the same time. Or you could draw a fancy border, and show the movie inside it.

You need not do any of these things with your code, but you should definitely test it in rectangles of various shapes and positions.

NOTE: DrawFrame should not call createwindow. In fact, your main program should call createwindow once, after which createwindow should never be called again.

III: Anagrams

An anagram of a word or phrase is a word or phrase that can be formed by rearranging the letters in the original word or phrase. For example, "dear" is an anagram of "read," "twelve plus one" is an anagram of "eleven plus two," and "Fjord Conifer Thereby" is an anagram of "Jeffrey Robert Ondich." There are more where those came from.

For this project, you will write a program that gets a word or phrase from the user and prints out a list of anagrams. You may use the dictionary file /Accounts/courses/cs117-1/words.txt to provide data for your anagram hunt. Also, you may restrict your anagram search to single words rather than words and phrases.

Anagram finding is pretty tricky, and there are lots of ways to approach it, but let me give you one idea. You can compute something we'll call the "signature" of a word (or phrase, for that matter) by making an alphabetical list of the letters in the word. Thus, for example, the words "dear" and "read" both have the signature "ader." Perhaps you can put the signature idea to use.

IV: Boggle

The word game Boggle ((tm) Parker Brothers) is my favorite game, so it was guaranteed to show up in my classes some time or other. I'm not going to describe Boggle here. You can take a look at it in my office or go buy it yourself.

For this project, you will write a program that generates a random Boggle board, prints it out, and then prints a list of all the words contained in the printed board using the Boggle rules. You may use the file /Accounts/courses/cs117-1/words.txt as the authority on what words are legal.

This problem is easy to state, but not so easy to solve. Good luck.

What to Hand In?

Grading Criteria

That's all

If you have questions, please let me know. I'll be away from campus on June 4-5, but I'll be around throughout finals week otherwise.

Start early, stay in touch, and have fun.



Jeff Ondich, Department of Mathematics and Computer Science, Carleton College, Northfield, MN 55057, (507) 646-4364, jondich@carleton.edu