What about this,
I created such a algorithm that works fine for my purposes, but one thing
Code:
char* puzzle[LENGHT] = {"jerome",
"emorej",
"rxxxxx",
"oxxxxx",
"mxxxxx",
"exxxxx" };
char* word[1]={"jerome"};
here is my declarations then I'm goona search "jerome" in puzzle,
to do that;
Code:
for(i=0;i<LENGHT;i++){
for(j=0;j<5;j++){
strcpy(temp,*(puzzle+i));
start=strstr(temp,*(words+j));
if(start!=NULL){
printf("the Word \"%s\" is Found at %d.Line LEFT to RIGHT\n",words[j],i);
This part was to search from left to right and in the other part I reverse the puzzle lines one by one and check them, revers is like shown below;
Code:
for(k=0;k<LENGHT;k++){ //x is equal to 1 while declaring
temp2[k]=temp[LENGHT-x];
x++;}
x=1;
for instance ABCD->DCBA and research from them, if I'm looking for DCBA I may reach the result and printed it as right to left.
And as a entire code it works, the point is what kind of algorithm may help me to make a Up and Down search like
ABCAB
BCARA
RHARH
suppose, I'm looking for "BAH" or "HAB"...
For now I'm thinkin of it, but I couldt get any solution yet