Vous êtes sur la page 1sur 1

Second Assignment 25.2.

2014
Due date: August 3, 2014 @ 23:59
Write a program in C to find the hidden words in a matrix of letters. Words will be created by chaining
the letters. You may start with any letter in the matrix to find the word and proceed in any of 8
directions (through surrounding 8 characters). You are expected to complete the assignment in two
stages.
In the first stage letters should be searched in straight lines, i.e. once a direction is selected search
should proceed in the same direction. Words may overlap with each other either partially or totally.
Along with the search implementation in the first stage you are expected to implement another search
approach for the second stage. In this new type of search direction of search may also change at each
letter. Previously used letters cannot be revisited in the same word.
The maximum size of the matrix is 100x100. The matrix, char wordbox [100][100], is supposed to be
initialized when it is defined in the code. User is expected to enter a string and the program prompts a
reply. If the word exists, the list of letter chain has to be printed on screen, such as
(1,1)(2,2)(3,3)(4,4)(5,5) for APPLE in the below given example. If the word does not exist a message
indicating the state has to be printed on screen. The program terminates when user enters EOF.

Examples of valid words for the first stage of the assignment
Diagonals
(1,1) APPLE, (4,1) WARD, (4,1) WAR (From upper left to lower right)
(7,4) DRAW, (6,5) RAW (Form lower right to upper left)
(3,5) PLOT (From upper right to lower left)
(8,2) TAPE (From lower left to upper right)
Straights
(4,4) LIER (From left to right)
(7,8) STAND (From right to left)
(3,5) PIE (from up to down)
(4,7) ROOT (from down to up)


Examples of valid words for the second stage of the assignment
REALISTIC (4,7)(4,6)(5,6)(6,6)(6,7)(7,8)(7,7)(6,8)(5,8)
TESTER (5,1)(4,2)(4,3)(3,2)(2,1)(3,1)

An example of an invalid word for the second stage
TESTER (5,1)(4,2)(4,3)(3,2)(4,2)(3,1)
Note that it is not a valid solution since E (4,2) cannot be revisited
more than once.
A X S E F V T C
E P G Q A D O S
R T P J P J O Z
W
E S L I E R
M
T A O L E A T C
U T R P E L I I
K P A D N A T S
S T A U R E Y E
A X S E F V T C
E P G Q A D O S
R T P J P J O Z
W
E S L I E R
M
T A O L E A T C
U T R P E L I I
K P A D N A T S
S K A U R E Y E