This is a C Assignment for a Boggle Board.
The assignment is to search a 4x4 board of characters for words in the dictionary by starting at a tile and moving up, down, left, right, or diagonally at any point. My program "jumps" from one point to another, spelling words from letters that aren't adjacent, and adding words many times.
void goToNextLetter(struct trie* dictionary, char boggleBoard[SIDELENGTH][SIDELENGTH], int usedLetters[SIDELENGTH][SIDELENGTH], char word[MAX], int row, int column){
int i, rowTemp, colTemp;
if (isPrefix(dictionary, word, 0)){
if (isInDictionary(dictionary, word, 0)){
printf("%s\n", word);
}
word[strlen(word)]=boggleBoard[row][column];
usedLetters[row][column]=1;
//printf("%d\t%d\t%s\n", row, column, word);
for (i=0; i<D_SIZE; i++){
rowTemp=row+DY[i];
colTemp=column+DX[i];
if ((rowTemp<SIDELENGTH) && (rowTemp>=0) && (colTemp>=0) && (colTemp<SIDELENGTH) && (usedLetters[rowTemp][colTemp]==0)){
goToNextLetter(dictionary, boggleBoard, usedLetters, word, rowTemp, colTemp);
}
}
//remove the last letter of word
word[strlen(word)-1] = 0;
usedLetters[row][column]=0;
}
}