A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Making a word game in as3. Don't know how to start. Help!

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    20

    Making a word game in as3. Don't know how to start. Help!

    Hi everyone, I am making a word game app in flash for the touch screens, except I really don't know how to have the game recognize words. Is there some trick to doing this? To be a little more clear, I want to know how I can make the game recognize real words that the player will be putting together. I'm pretty sure I know how to have the game recognize the player's chosen letters, but that's really about it. Thank you for any help.

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You need to figure out some requirements to know the best way to proceed.

    Is it something where speed is an issue? If not, can you try to get the information from requesting it from another server on the internet?

    If getting it from a server is an option, then maybe just use dictionary.com or something like that.
    If not, then you'll need to store your word data locally. How big is your dictionary? Most reasonable dictionaries are too big to store as plain text in your swf. Plus, looking it up in a plain text or array is slow.

    One solution is to make a trie.

    The basic idea is a lot like a binary tree, except that instead of 2 possible children, each node has 26 possible children, one for each letter. Each node also stores a flag showing whether the word corresponding to the path from the root to that node is a valid word. One advantage of this is that if you are evaluating from a prefix, you can easily tell when you can stop looking. For instance if you are given the input "kqroom", you can stop looking when you see that there are no words starting with kq.

    The trie representation is fairly efficient.

    I made a trie for words for a Dictionary.com contest a while back. I might be able to dig it up for you.

    But if space is absolutely critical, and you don't mind a slight possibility of false positives, you can use a Bloom filter.

    Bloom filters store a unique fingerprint of a word in a small binary array. If each bit that the word hashes to is set to true in the array, the word is considered valid.

    Obviously Bloom filters work well for situations where space is an absolute premium. But, they do have a slight possibility of false positives (but not false negatives). And if you wanted to enumerate your words for some reason, you cannot do that.

  3. #3
    Junior Member
    Join Date
    Oct 2011
    Posts
    20
    Wow that's amazing you know all this. I would really like to see your trie you were talking about. Space is somewhat a critical aspect here, but I am willing to try your different solutions. This is the first I've heard of such techniques so I'd really appreciate any more information, code, links, etc. Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center