The relation between input Trie* to guess

At the function char* guess(Trie* dict, int k)…
why should we take the Trie* dict, because it stored our words? But we only need to let the player input an invalid word to the char* guess and return it…
how are we supposed to use Trie* dict in this context? I do not think we should load word from it?

Is it because the very last sentence “The check should always succeed if the dictionary given is a null pointer”? if it is so, what are we supposed to return in our char* guess?

image
The dictionary is used to check whether a guess is valid, except if it is NULL, then every guess of correct length is valid.

The first valid guess, as usual.

Nope. You are supposed to reject invalid words, and only accept valid words. That is, words of correct length that are in the given dictionary/trie.

Note that guess is a function returning a char*, and not a variable. You do not store anything to it. You likely know this, but the way you describe what should happen does not make it seem like it.

2 Likes

sorry for the carelessness and thanks for your help. I think I know how to do it now. :+1:

1 Like