Computer Science Canada

Help with FinalProject.

Author:  SenorDingDong [ Wed Oct 29, 2003 10:18 pm ]
Post subject:  Help with FinalProject.

Hello, I have a final project due in two weeks, and I dont really know how to approach making this. My Turng knowledge I'd say is about moderate, not advanced.

Anyway heres the problem:


Hide and Seek

Sample Data:
10 DATA WJSUOJ, JUFEDR, OFECDR, YUFRAS, YUHOKE, YHTWAS
20 DATA CAKE

1.) A series of words are read and considered as a square array. The dimensions of the array will be dtermined by the length of the first word read. In the above case the array would look as follows.

6 W J S U O J
5 U J F E D R
4 O F E C D R
3 Y U F R A S
2 Y U H O K E
1 Y H T W A S

1 2 3 4 5 6

2.) The additional word read is hidden somewhere in the array in such a way that each succesive lteer in the word touches the previoues letter diagonally, vertically, or horizontally. Examples of this are as follows:

C A E K K
A K C C A A E
E K E C

3.) Find any one solution to the hidden word by printing the word in the way it appears and the co-ordinates of each letter in the word.

4.) Note that the first word read is placed in the top row of the array and that the bottom left hand corner of the array is considered to be (1,1). There will be no more then 8 words forming the square array and the hidden word will be no more then 5 letters long.

Sample Output:

C
A
K E

C (4,4) A (5,3) K (5,2) E(6,2)

any help would be appreciated.

Author:  Tony [ Wed Oct 29, 2003 10:46 pm ]
Post subject: 

sounds simple enough.

first you load your "playing field" into a 2D array. Read my tutorial on arrays if you're not sure how to use them.

Then go through each letter, searching for the first letter of the word. If it matches, you check all surrounding letters for 2nd letter, and continue so until you match the whole word.

You would have to use a self-calling function in here. As soon as whole word is matched, just redraw your letters in different color. Using Font. will make your project look good Wink


: