Sunday, October 25, 2009

Approval

So the email came from Apple and the application is live on the store, which is great. It took about 9 days to be approved, certainly not what I had expected - in fact I had almost expected rejection or demand for a higher rating since a player who so wishes could spell all kinds of naughty words given the right set of random letters. Other application developers have come across this problem apparently just because their apps could access someone else's content - like a web page or an eBook.

Writing this thing was fun but not as easy as first thought. Or to be more accurate doing it so that it was fast enough to play was difficult. The SOWPODS word list is very large, 2.8MB of text, which takes an appreciable time to load into the application even before processing begins. Many words are greater than 9 letters so since this game only deals with words of 9 letters or less the word list can be made smaller without affecting the game at all.

Calculating the solution for a random word and key letter was an interesting problem. At first it seems easy. The method is fairly well-known and involves sorting every word in the word list, sorting every possible word from the puzzle word and looking for the intersection. First problem - using arrays for this is very slow since looking for the word can involve hundreds of thousands of comparisons and that task is multiplied by the number of words in the dictionary. Second problem, if "LILT" is a word in the solution then so is "TILL" - you can't just stop looking after the first match. The advantage of calculating the whole solution in a background thread is that once done the complete solution is available at any time and it makes response better when checking words as they are built letter-by-letter.

No comments:

Post a Comment