CS 107 (Fall '02)
[Schedule]
[Examples] [Programs]
[Notes & Reference] [Syllabus]
[Lab & TA] [Tests]
[Grades]
Prof. Reed, CS 107, Fall `02
Due Wednesday 11/20/02 at 2:30 in the afternoon
Last update: 11/8 at 2:00
This is a word-guessing game. The computer generates a board at random and figures out how many valid words can be found on the board, displaying this number to the user. The user then tries to find as many as possible, where the computer keeps track of the words the user has found so far. The user can also request that the computer's words be displayed on the screen. Take a look at the sample run below:
[ernie] ~/programs/compare> compare Author: Dale Reed Assignment: #5, Compare TA: Thef Inals Tretch, Sat 1:00-1:05 See how many words you can find in the board below. Words must be at least 3 characters long and can be placed vertically, horizontally, or diagonally in any direction. The computer will help you keep track of which words you have found so far. Enter 'x' to exit the program, 'l' to list the words you have found so far, or 's' to have the computer suggest words you have not yet found. Computer has found 60 words. User has found 0 words. 0 1 2 3 4 5 6 7 8 9 -------------------- A| r w v q z w q f i t B| u p n p q h i m w w C| k b v t d q l k a a D| p m s d b z t r n h E| f j e y e j r i p g F| s n l a d m v m c h G| z p i r d c o u h i H| z p o t a r u g x j I| v s v t p n k t z c J| t u j o o w d v z m Enter the starting position and the word (or l, s, or x): d 3 den Congratulations, you found: den Computer has found 60 words. User has found 1 words. 0 1 2 3 4 5 6 7 8 9 -------------------- A| r w v q z w q f i t B| u p n p q h i m w w C| k b v t d q l k a a D| p m s d b z t r n h E| f j e y e j r i p g F| s n l a d m v m c h G| z p i r d c o u h i H| z p o t a r u g x j I| v s v t p n k t z c J| t u j o o w d v z m Enter the starting position and the word (or l, s, or x): d 3 den Congratulations, you found: den You previously guessed that word. Try again. Computer has found 60 words. User has found 1 words. 0 1 2 3 4 5 6 7 8 9 -------------------- A| r w v q z w q f i t B| u p n p q h i m w w C| k b v t d q l k a a D| p m s d b z t r n h E| f j e y e j r i p g F| s n l a d m v m c h G| z p i r d c o u h i H| z p o t a r u g x j I| v s v t p n k t z c J| t u j o o w d v z m Enter the starting position and the word (or l, s, or x): d 1 mead Congratulations, you found: mead Computer has found 60 words. User has found 2 words. 0 1 2 3 4 5 6 7 8 9 -------------------- A| r w v q z w q f i t B| u p n p q h i m w w C| k b v t d q l k a a D| p m s d b z t r n h E| f j e y e j r i p g F| s n l a d m v m c h G| z p i r d c o u h i H| z p o t a r u g x j I| v s v t p n k t z c J| t u j o o w d v z m Enter the starting position and the word (or l, s, or x): a 7 fits That word is not on the board. Computer has found 60 words. User has found 2 words. 0 1 2 3 4 5 6 7 8 9 -------------------- A| r w v q z w q f i t B| u p n p q h i m w w C| k b v t d q l k a a D| p m s d b z t r n h E| f j e y e j r i p g F| s n l a d m v m c h G| z p i r d c o u h i H| z p o t a r u g x j I| v s v t p n k t z c J| t u j o o w d v z m Enter the starting position and the word (or l, s, or x): l den mead Computer has found 60 words. User has found 2 words. 0 1 2 3 4 5 6 7 8 9 -------------------- A| r w v q z w q f i t B| u p n p q h i m w w C| k b v t d q l k a a D| p m s d b z t r n h E| f j e y e j r i p g F| s n l a d m v m c h G| z p i r d c o u h i H| z p o t a r u g x j I| v s v t p n k t z c J| t u j o o w d v z m Enter the starting position and the word (or l, s, or x): s add and ani art atop bed cat cit cut demo dna drip eli eye eye fit
gum ham haw him irk jut lad mph mug ned nit nrc oil ott pad ply pot
pot pro prom ran rand rat raw ray rim rip rip romp rug spot tar tic
tin top top tray twa wah wan war woo Computer has found 60 words. User has found 2 words. 0 1 2 3 4 5 6 7 8 9 -------------------- A| r w v q z w q f i t B| u p n p q h i m w w C| k b v t d q l k a a D| p m s d b z t r n h E| f j e y e j r i p g F| s n l a d m v m c h G| z p i r d c o u h i H| z p o t a r u g x j I| v s v t p n k t z c J| t u j o o w d v z m Enter the starting position and the word (or l, s, or x): x Exiting... [ernie] ~/programs/compare>
~i107/programs/compare/compare
Note that this will not work unless you have the dictionary.txt file in your current directory. You can copy this from the web site, or enter the following Unix command to do this:
ln -s /usr/dict/words dictionary.txt
turnin -c cs107 -p compare prog5.c
where your file name in your account is prog5.c
[CS Dept] [UIC]
[Prof. Reed]