CPSC 317 Extra Credit projects (value: between zero and 10% of grade for the class)
Choose one of each of these three (A-C) categories: Category A
write
a shell script that takes three words as parameters from the command
line and returns, as output, only that word which is longest (has the
most characters. The program should look and run like this:
for i in ham artichoke kindle; do stuff
artichoke
For full credit, the length of the program, from do until end should be no more than fifty characters.
We wish to determine if two strings contain any
of the same letters. Output should consist of a count of the number of shared letters, and on the same line,
a listing of the shared letters. The program should look and run like this
$ ./common thermostat hamburger
"thermostat" and "hamburger" share 5 letters: a e h m r
The program's size (as measured by lines and chars) should not be substantially greater than mine $ wc common 3 22 158 common
Category B
Write
a shell program using the dictionary (on obsidian)
at /home/SRUNET/david.dailey/words, that accepts a comma-delimited
pair=(letter,number) and returns the number of words in the dictionary
(as well as the first and last examples) of words containing exactly
(and no more) number instances of letter within them. Input and output should look like this
$ ./exact n,4 There are 36 words having exactly 4 "n"s in them. The first and last are announcement and unmeaningness
or
$ ./exact i,6 There are 3 words having exactly 6 "i"s in them. The first and last are indistinguishability and indivisibility
Come up
with a "heuristic" process for
finding "stuffed" crossword puzzles -- those with no blank spaces, and
words in each row and column, where each word is a word in /home/SRUNET/david.dailey/words.
A
R
E
A
B
E
A
R
E
A
S
T
T
R
E
Y
D
O
O
R
U
R
G
E
M
A
L
E
B
L
E
D
Q
U
I
C
K
U
N
M
A
N
I
M
B
U
E
C
A
U
S
E
K
N
E
E
L
Category C
Generalize the program of B1 so that it accepts a space-delimited sequence of letter,number pairs
$ ./exact l1,n1 l2,n2 l3,n3 ... lm,nm $ ./exact i,6 y,1 There are 3 words having exactly 6 "i"s and 1 "y"s in them including indistinguishability and indivisibility
The output should be words that have exactly nj occurrences of lj for all values of j (at the same time)
Consider the lessons here.
Define "mutual anagrams" that words that share the same letters with
exactly the same frequency (like "medical" and "decimal" and "claimed"
and "pool" , "loop", and "polo", but not "area" and "are") develop a
script that finds all nine letter anagrams from the words at /home/SRUNET/david.dailey/words. (examples: bacterial calibrate carthorse orchestra coastline sectional unaltered unrelated deflation defoliant)