Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm building a game where I form words (think Scrabble) and I need to have them validated in real-time, meaning that I need to have some sort of word list loaded where I can check if the word made exists or not.

I was wondering what would be the best way to store that list, should I just create an Array or use some sort of database (sqlite3 in this case).

Thanks

share|improve this question
add comment

1 Answer

One of the most space-efficient ways to store dictionary words for quick lookup is a trie.

share|improve this answer
    
I used a trie for a game I wrote in Actionscript 3 with good results. My dictionary had about 80,000 words and I scanned the board for all possible words in real time. The advantage of a trie over a dictionary is better space efficiency and the ability to find all prefixed words in a string. i.e. the string "catchers" contains the words "cat", "catcher", and "catchers". –  Alex Schearer Sep 28 '10 at 18:19
    
Thanks, I will take a look at trie. Never heard of them to be honest. –  IvanSF Sep 29 '10 at 19:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.