The following are the program concepts, submitted by students, that are to serve as the basis for assignments 2-6. These are of mixed difficulty and of mixed specificity. In some cases you will be able to implement only a part of the idea in the time provided for the assignment, while in other cases you will be able to implement the complete idea and several extensions. (I have listed some possible extensions, but you may want to develop some of your own.) In some cases the idea is fully spelled-out below, while in other cases you will have to fill in several of the details.
What I expect for assignments 2-6: For assignment 2 (C/Pascal -- languages in which you are already fluent) I expect you to spend approximately 1 hour writing code. For each of the later assignments I expect you to spend approximately 3 or 4 hours programming. I am not looking for a large volume of code or for programs that "merely" meet one of the listed specifications. Rather, I am looking for evidence that you have applied yourself and that you appreciate the features of each programming paradigm.
Because I edited and otherwise transformed several of these concepts, I've removed author names from all of them.
Input would be random words or letters typed in by the user. The output would be all the possible words or combination of words that could be produced from the input.
Input: a text file containing a list of quotes. Each quote can be multiple lines; it must be separated from quotes before and after it with a "###" symbol placed on a line by itself.
Output: One of the quotes, defined as all text between two '###' separator lines, not including the separator lines. This quote should be chosen at random from the available input.
sample file: --------- Spam, spam, spam, spam.... ### Interesting website of the day: CNN Online, http://www.cnn.com/ --------------------------------------------------------------- ### Renee Landrum, Smith College, Northampton, MA email@example.com ------
It will ask the user a series of questions, and keep track of how many answers correspond to yours.
For example, if you really love the color purple, you might have the program ask "What is your favorite color". The user might answer "purple." If the users answer, purple, matches up to your answer purple, then that's one thing you have in common. The computer keeps track of how many things you have in common. If the user's answers correspond to yours quite frequently, like if you ask 10 questions and 9 times the user's answer is the same as yours, the program can say something like "Hey, we have a lot in common! We should definitely meet sometime."
On the other hand, the user could be someone you never, ever want to meet. For example, if you are gay, you might ask. "How do you feel about gay people? Do you think they should be burned at the stake?" If the person answers "Yes", chances are that this isn't someone you want to meet. In which case you would have your program say "I'm sorry, we just can't get along" and exit quickly. You could also have keywords that make the program end. Like, if you're an evangelical Christian, and you ask the user what religion they prescribe to, and they answer "Satanist", that might be the program's cue to end.
Basically, talking to the program is much like talking to you. This lets the user figure out whether or not they like you, and lets you screen out any undesirables who don't meet up to your standards of personality.
The program will request certain parts of speak from the user.
The program will output the finished non-sense story.
Output: 90 minute mix of various songs divided into two 45 minute sides.
Ideally, the program will find an optimal "packing" of songs; that is, it will find a mix that minimizes the wasted (blank) space at the end of each side.
Possible extension: annotate songs with descriptive keywords and produce mixes that take these into account. For example, you might ask for a slow mix, or a blues mix, or a mix that alternates slow and fast songs.
Data: Small Dictionary (words only in alphabetical order)
Input: Word to be spell-checked
Output: If word exists in dictionary, then output: correct; else, output: No such word.
Possible extension: List possible corrections for misspelled words.
Possible enhancement: To save space, most spell check programs store their dictionaries in a tree structure (e.g. a B-tree) rather than in a linear list. Implement a tree-structured dictionary for your spell check program.
Input: Coordinates for several positions through which cube will move. These should be given by the coordinates (in 3D) of two opposite corners. The cube will move through each of these positions, in order, taking the shortest route each time.
Output: The complete list of coordinates for cool looking cube that moves in 3D.
Possible enhancement: Find a rendering/animation package that can produce the actual 3D images and have your program produce output in a format that this package can read. (Although most of the languages we'll be using have graphics libraries, we will only be covering text input/output in the class.)
User input: his or her name
User Input: a certain noun that they would like to see in the poem
Output: a Haiku in the format of three lines containing 5, 7, and 5 syllables, using the user's word.
User Input: a birthday
Output: two paragraphs describing a horoscope for the astrological and Chinese of the particular birthday. (Maybe you could add the cycle of the moon as well.)
1100011 1011101 1011111 1100011 1111101 1011101 1100011This represents the letter 'S'. This is called the tested array. The second set of input is a set of 3 two-dimensional arrays of exactly the same sizes. They might represent the letters 'E', 'B', and 'H', or they might not represent anything meaningful to us at all. The program is required to analyze the tested array with the other set of 3 two-dimensional arrays, and output which one of the second set 'looks' like the tested array most. That is, which one looks like the character 'S' most.
2. Determine whether user-supplied text is or is not a palindrome (the same backwards as forwards).
3. Given a dictionary (word list) find palindromes consisting of words from the dictionary.
Input: A text file.
Output: A list of the alphabet and the number of times that each letter appears in the file, next to that letter.
Students input: name.
Output: balance of financial aid.
The user would then be asked to guess a letter. If the letter occurs in the word then the program would show the user where the letter and all previously guessed letters occur. For example, if the user guesses "a" then the program would output:
If, on the other hand, the letter does not occur in the word, then this counts as a point against the user. This may be presented to the user by adding a body part to a stick figure hanging from a gallows (hence the name "hangman"). If the user acquires 6 points (that is, the stick figure is complete: head, body, leg, leg, arm, arm... or some people allow for more points and include feet, face parts, etc.) before completing the word then the user loses. When this happens the system outputs "you lose" and the complete word.
Output: various judgements of the text's quality. These may include simple measures like word count (see above), intermediate measures like "reading level" (for which there are several standard algorithms), and much more complex measures like aesthetics of rhythm, rhyme, and meaning (very big open research problems lurk herein!).
Possible extension: Allow for a variety of date calculations. For example, allow the user to find the date of the day that is 90 days after Feb 15, 1998.
Another possible extension: Given a month and year, print a calendar for that month.
Input: number of squares in the wall
Output: number of diagonals needed
Input: number of paintings, each painting's "personal space," number of walls, dimensions on each wall that can be used
Output: location for each painting
The simple i/o of the program would be, of course, that the player tells the computer their choice, the computer (either randomly or through an algorithm) will compare it's choice with the human players, announce the winners, and loop till the human gets sick of the whole deal. Alternate i/o would be to play over a network with another human player (having each player enter in their guesses in front of each other would sort of defeat the point) or have the computer play itself, perhaps with two different programs within. More fun would be to pick the method that the computer uses (human input, pick a position randomly, or choose an algorithm to use) and see which way works best. The basic structure of the program:
Output "Choose a number between 1-100, and I will guess it"
Possible (difficult!) extension: The user picks a numerical property,
like "multiple of 3," "factor of 100," or even "one more than a prime,"
and the computer tries to guess this.
Output: a description of the best way to "call" the hand -- for example,
"3 Aces" or "Flush Hearts."
Possible extensions: allow for wild cards, games with many cards per hand
(e.g. 7-card stud), high/low games, games in which "up" cards of other
players are known, etc.
Output "is it 50?"
Output "is it higher or lower?"
Output "is it 25?"
Output" is it higher or lower?"
Output "Is it 37?"
....and so on until it guesses it.
Poker Hand Computer
Input: a description of the cards in a hand of poker.
Possible (difficult!) extension: The user picks a numerical property, like "multiple of 3," "factor of 100," or even "one more than a prime," and the computer tries to guess this.
Output: a description of the best way to "call" the hand -- for example, "3 Aces" or "Flush Hearts."
Possible extensions: allow for wild cards, games with many cards per hand (e.g. 7-card stud), high/low games, games in which "up" cards of other players are known, etc.