Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple error messages shown for invalid word #5

Open
frolino opened this issue May 4, 2016 · 0 comments
Open

Multiple error messages shown for invalid word #5

frolino opened this issue May 4, 2016 · 0 comments

Comments

@frolino
Copy link

frolino commented May 4, 2016

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant