Docsity

CSP 196 Final Project Descriptions for Fall 2007, Study Guides, Projects, Research of Computer Science

Toggle sidebar
bg1
CPS 196 Fall 2007
Final Project Descriptions
For the final project, you may write one of the applications described here, or you may
propose an application of your own. This is an introductory class, so the application
should be small. This is an individual assignment; you will not be working in groups.
While you may certainly talk each other and share ideas, you are expected to write the
project yourself.
The project will be submitted in two parts: The first part will be a planning document
describing your user interface in detail and it will tentatively be due by the next-to-last
class on December 3. The second part will be the entire project with code, files and
documentation to be handed in by December 17.
In addition to the normal requirements to incorporate good programming style, there will
be technical requirements to include certain features in your program. These are:
Interactive input and output with the user
Input and output from/to files
Arrays
A searching function
Some randomness, using the random number generator
Well organized code using functions
References, including sources describing the project (such as on-line game instructions)
and any people who helped discuss the project with you.
Suggested Projects:
1. Game: Three in a Row
This is a solitaire game. The computer will generate a deck of cards and shuffle it. To
play the game, the computer asks the player for a move and the player can respond with
either an โ€˜Dโ€™ meaning to deal one card, or a โ€˜Pโ€™ meaning to pick up the last three cards,
which must be all of one suit. Each time the player types in a move, the computer shows
the board with the state of the game up to and including that move. If the player tries to
pick up the last three cards and they are not all of one suit, the computer will indicate an
error and will ask for another move. Play continues until the end of the deck. If there are
no more cards played on the board, then the player wins.
Each player will use a set of initials and a record will be kept in a file of all players, how
many games they have tried and how many they have won. A player starting a game will
be shown their statistics from the file.
2. Computing PI with Monte Carlo Simulation
pf3

Partial preview of the text

Download CSP 196 Final Project Descriptions for Fall 2007 and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

CPS 196 Fall 2007 Final Project Descriptions

For the final project, you may write one of the applications described here, or you may propose an application of your own. This is an introductory class, so the application should be small. This is an individual assignment; you will not be working in groups. While you may certainly talk each other and share ideas, you are expected to write the project yourself.

The project will be submitted in two parts: The first part will be a planning document describing your user interface in detail and it will tentatively be due by the next-to-last class on December 3. The second part will be the entire project with code, files and documentation to be handed in by December 17.

In addition to the normal requirements to incorporate good programming style, there will be technical requirements to include certain features in your program. These are:

Interactive input and output with the user Input and output from/to files Arrays A searching function Some randomness, using the random number generator Well organized code using functions References, including sources describing the project (such as on-line game instructions) and any people who helped discuss the project with you.

Suggested Projects:

  1. Game: Three in a Row

This is a solitaire game. The computer will generate a deck of cards and shuffle it. To play the game, the computer asks the player for a move and the player can respond with either an โ€˜Dโ€™ meaning to deal one card, or a โ€˜Pโ€™ meaning to pick up the last three cards, which must be all of one suit. Each time the player types in a move, the computer shows the board with the state of the game up to and including that move. If the player tries to pick up the last three cards and they are not all of one suit, the computer will indicate an error and will ask for another move. Play continues until the end of the deck. If there are no more cards played on the board, then the player wins.

Each player will use a set of initials and a record will be kept in a file of all players, how many games they have tried and how many they have won. A player starting a game will be shown their statistics from the file.

  1. Computing PI with Monte Carlo Simulation

Consider the function for a circle with one quarter of the function drawn in the unit circle, i.e. x and y both range from 0 to 1, and the function for the circle is x^2 + y^2 = 1.

We use Monte Carlo simulation (which means a simulation in which we use random numbers to generate points) to estimate the area inside the circle function. To do this we use the random number generator to generate pairs of numbers x and y, both ranging from 0 to 1. We test whether the point (x, y) is inside the circle or outside by testing whether substituting them in the function x^2 + y^2 is < 1 (inside the circle) or > 1 (outside the circle). As we generate pairs of numbers, we keep track of how many are inside the circle and outside it, and we use the ratio of the numbers inside to the total numbers generated to compute the area inside the circle.

Now we know that the area of a circle is ฯ€ r^2 , and since the radius of the unit circle is 1, the area of the entire circle should be the value of ฯ€. Since we computed only ยผ of the area, we will multiply our area by 4 to get the value of ฯ€.

The accuracy of the calculation should depend on the number of trials needed to smooth out the random effects of the trials. The program should be set up so that it reads a file that tells it a sequence of numbers that are the number of points to be generated and a repetition number to repeat the simulation at each number of trials. The result of the program should be a report given both on the monitor and in a file of the resulting values of pi for all of the simulations.

  1. Document Retrieval

For this project, I will make for you a small collection of documents that a user can search for. The user will be able to put in keyword queries of one or two words, and the top-ranked document will be printed in answer to the query.

The program will have two parts. The first part is the indexer, and it is run once before the user can make any queries. It will read all the documents, separate each document into words, and build an index that allows shows for each word what documents it is in and what its frequency of occurrence is in that document. This index is then written to a file.

The second part allows the user to make queries. It will read the index file and ask the user to make a query. The user can type in one or two words to be used as keywords. The program will use the word frequencies in the index to rank all the documents according to how well they match the keywords. The top-ranked document can be typed out for the user. Or similarly to Google, you can type out the first few lines of the top 10 ranked documents. The standard formula for computing the ranking is called the tf/idf formula, and I will give the details later.

  1. Other options for projects