iDevGames Forums
Word games? - Printable Version

+- iDevGames Forums (
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: Word games? (/thread-1421.html)

Word games? - jeonghyunhan - Apr 20, 2009 06:46 PM

This is my first attempt at a word game and I have absolutely no idea how to start.
Say for example I have two UIImageViews one with an image letter "A" and the other "B" and if I connected them to form "AB" how can I detect that and look it up in a list of words that I provide?
Or is that the wrong approach?
Anyone who has done a game that mixes and matches letters to make words know of a good place to start?

Word games? - maximile - Apr 21, 2009 08:11 AM

Is this going to be grid-based? If so, it's best to think about how to represent the grid in memory. Then it'll be a much simpler task to test for words.

You might want to read up a bit on the Model-View-Controller concept. While it doesn't always apply nicely to games, it's usually a good starting point.

Word games? - jeonghyunhan - Apr 21, 2009 11:07 AM

Thanks for the tip.
I've just finished a grid based game so that should help.
I've never done the model-view-controller way of things but i'll give it a shot now.

But I still don't get how you would test for words.

Word games? - maximile - Apr 21, 2009 11:26 AM

Well, say your grid was represented by an array of characters (NSString, char *, whatever). One method would be to go along each row, checking for a character. When one is found, add it to an array. Then check the next grid square, adding characters to the array until there's a blank cell or the end of the grid. Then use the array you've generated to make a string, and check if it exists in your dictionary.

You'd need to then check vertically in a similar way.

Word games? - jeonghyunhan - Apr 23, 2009 08:48 PM

What if my grid was represented by UIViews or UIImageViews?
I'm using UIViews/UIImageViews partly because it's the only way i know of how to actually represent a grid and use images.
I'm trying to figure out how to connect my "images" of each letter to actual letters and use those letters to determine words from a dictionary.