Tavern Puzzles

So I had this idea for a puzzle that would be a mini-game inside of War of Words.  Then I decided a few weeks ago not to do it.  Now I’ve decided to do it, but this time change how the puzzle works.

The new puzzle involves a 7×7 grid of letter tiles.  The objective is to make words out of the letter tiles that give you word score and then attempt to surpass the stated word score to beat.  For example, you will be given a bunch of tiles and it will say that you need 100 points or more to win.  This task can be further twisted by the introduction of score multiplier blocks (they double or triple the word).

There are many subtle strategies for winning this game.  First of all, you must carefully use the available vowels.  If you use all of them, you will no longer be able to make words (except for words using Y as an approximate vowel, assuming Y is still available).  Second, using the rarer letter tiles will definitely yield more points (the letters X, Z, Q, and J, and K are especially high scoring).  Third, the length of a word can yield higher scores, especially words longer than 12 characters in length.  You can get really high scoring words by combining both rarity and length.  For example, JUXTAPOSITIONAL is worth a whopping 70 points. If any one of those letters is a 3x multiplier, you could score up to 210 points in a single word!

From a technical standpoint, this mini-game is not difficult to code.  The only new thing I had to come up with was a simple test to determine when the player has exhausted all possible words.  This involved modifying the word graph to report to me when a word is no longer possible given a set of letters.  In this case, I’m not interested in the actual words themselves, but just in answering the question of whether there is even one possible word or not.

I did find, however, that my word list contains words that are pretty hard to guess.   They are nonsensical words that are commonly spelled out in text such as “HMM” or “AARGH”.  I think these aren’t really words so I’m going to get rid of them.  One strategy is when I am importing words to trim out any words that do not contain a vowel or the letter Y.  This should get rid of words like “HMM” and “BRR”.  However, this still leaves behind words like “AARGH” because it contains vowels.  I think this is OK, it isn’t going to be perfect.  I can always manually remove specific words in the list, but with nearly 170,000 words to browse, it is hard to be completely thorough.

I really want to build an AI that can play this game, even though there are no plans to have a computer version of this player.  I just want to see if I can find an efficient way to solve the problem (it would help with testing).  I’d basically like to maximize the score while at the same time using as many of the letter tiles as possible.  It is probably not possible to use all tiles in all situations, but a well designed algorithm could probably get pretty close.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: