Making a Boggle Clone?
hi!
yesterday, for no apparent reason, i remembered a project i started (and abandoned) a long time ago: a boggle clone. The main problem I had with the game was this: how do can you make each board totally random, yet be able to check for words. I know how to make the board random, and how to see if that word actually is there, but how would you check to see if the player entered a real word? so that brings me to my question: is there any function inside a library/header file/code/etc... that could allow me to use the word entered in as a parameter, and returns wether the word exists? thanx,
~~KaMiKaZ~~
+<--->+With your feet in the air and your head on the groundTry this trick and spin it, yeahYour head will collapseBut there's nothing in it And you'll ask yourselfWhere is my mind+<--->+
I don''t know for windows, but on most linux systems, you find the ispell library. Its actual use is spellchecking, but you can also make use of it in your game, since it has dictionaries in several languages so maybe you can use one of those. If you don''t mind using GPL that is.
Its basically just a dictionary lookup. You need to get a list of ''real words'' and then write a function which just, given a word, searches the word list for a match to see if the word is ''real''. There''s no magical algorithm for determining whether or not a word is valid.
Search on the web for "english word list" and you should find several sources of large word lists to use for your matching function.
Some things to consider: You probably want to add some algorithmic support for things like plurals. Like if the word is in the list, but missing an s at the end, its OK because its a plural (this would allow some degree of cheating as users could pluralize words that can''t normally be pluralized. If that really bothers you, you could store meta information along with the wordlist which marks things like what part of speech the word is, whether it should allow plurals of the word, etc, but that''s a much larger data management issue than a simple word list and probably not really needed).
Its also a good idea to let users add their own words to a seperate user created word list that''s also matched against. Again this might be used to ''cheat'' but if the user wants to ruin the game for him/herself, that''s their problem. But if there''s a word they commonly use that isnt in your approved word list its sure to tick them off.
Search on the web for "english word list" and you should find several sources of large word lists to use for your matching function.
Some things to consider: You probably want to add some algorithmic support for things like plurals. Like if the word is in the list, but missing an s at the end, its OK because its a plural (this would allow some degree of cheating as users could pluralize words that can''t normally be pluralized. If that really bothers you, you could store meta information along with the wordlist which marks things like what part of speech the word is, whether it should allow plurals of the word, etc, but that''s a much larger data management issue than a simple word list and probably not really needed).
Its also a good idea to let users add their own words to a seperate user created word list that''s also matched against. Again this might be used to ''cheat'' but if the user wants to ruin the game for him/herself, that''s their problem. But if there''s a word they commonly use that isnt in your approved word list its sure to tick them off.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement