A basic Word Puzzle Algorithm
Hi Everybody,
I'm tryin to build and basic word puzzle algorithm, by saying "basic" I mean that It's not supposed to find word acrossly, it must search only forward-backward ,up and down...
I must use Constant pointer arrays for all puzzle like the way below;
Code:
char* puzzle[LENGHT] = {"jerome",
"emorej",
"rxxxxx",
"oxxxxx",
"mxxxxx",
"exxxxx" };
char* word[1]={"jerome"};
When I first thought about it and made a couple of searches, I decided to use following way,
I'm gonna use an temp[] char array and in the loops, I'll read all Lines (forward<->backward,up<->down) into the char array and I'll search the temp by usin string processing tehniques (strstr vs...)...
What I cant do is, when I declared puzzle as string arrays not as one by one filling with chars, I couldn't be able to read strings one by one into "temp" array...
For instance in a loop
Code:
temp[i]=*(puzzle+1);
If I do this, it doesnt work anyway, or
Code:
strcopy(temp,*(puzzle+1));
It copies all the string into the temp array, How can I read the strings char by char into the temp array, or is there any easier way to do this?
Actually I'm lucky because, my alghorithm doesn't need to make a across search, that's why I'm gonna try to make it as easy-short as possible...
thanks for now