-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Since the played words are represented by a list, there are multiple error messages shown whenever a word that is a prefix of multiple played words is played.
For example, suppose the words PANGS and PANGRAM have been played. Then, suppose the next player plays the word PANG. In this case, two error messages that say, "That word can't be played," are shown - one for violating "PANGS", and the other for violating "PANGRAM". This gets worse if there's a lot of prefixes. For instances, suppose "HERONS", "HERON", "HERO", "HER", and "HE" have been played. If somebody tries to play "HE" again, there will be 5 error messages shown!
One way to fix this is by simply representing the played words as a prefix trie (or, by keeping track of whether a violation has already been reported)