Miscellany

Word Search Plus, puzzlegame for Android and iOS

Wordsearchplus icon

The game is a classic wordsearch puzzle game, with a twist not seen before.

The problem with previous puzzlegames of this type is that they either have puzzles with random, unrelated words, or they have a small set of pregenerated puzzles. Word Search Plus improves on the concept by allowing virtually any topic to become a puzzle.

Topics

It does this by asking the player to search for a topic, after which Wikipedia is queried to return a list of possible articles. The player then selects one of these articles, it is downloaded and then analyzed, and then a puzzle is generated.

The benefit is of course that a Wikipedia article tends to have words in it that are related to the subject. For example the Biology article contains words like genes, life, botany, and metabolism.

Configuration

The Preferences screen allows the player to specify parameters for the generated puzzles.

Statistics

The player can choose to have the app remember which puzzles were completed, and how long it took.

Inner workings

The game uses the Android Support Library to allow a consistent appearance on Android 2.3 and up. A custom AsyncTask subclass is used to have proper interaction between fragments and the download tasks.

Puzzle 'lifecycle'

Whenever the player changes the search term, the game queries the Wikipedia API for a list of possible articles. This list is then shown on screen, much like autocompletion on websites. If one of the items in the list is clicked, the Wikipedia API is asked to return a flattened version of the corresponding article. This JSON data is then analyzed and a list of words is extracted.

Puzzle generation

Then, a thread is started to generate an optimal puzzle. Several techniques exist to do this, with their own seperate drawbacks. In the end the most consistent results come from just trying random placements for the words, and assigning a score to a possible puzzle. Then for a few seconds (this is the 'Strength'-setting) try as many puzzles as possible, and pick the best, according to a certain metric. This metric then looks at things like reuse of letters (several words sharing a letter), variation in placements regarding to their direction: vertical/horizontal, left/right, etc. The thread can be aborted at any moment, if the player decides to cancel.

Languages

A player can specify the language he wants to play in, this creates an interesting challenge. For example in German the word "B├╝cher" will be transformed to "Buecher" when used in puzzles. In other languages, the umlaut (or any diacritic) is simply dropped.

And some languages have completely different alphabets. The challenge is to convert words and filter invalid words. In the end a language is defined like so:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
private static final LanguageSpec languageSpecRussian =
    new LanguageSpec(
        R.string.language_russian_title,
        R.string.language_russian_adjective,
        R.string.language_russian_wikiurlprefix,
        R.string.language_russian_initialwikiquery,
        R.string.language_russian_prefcode,
        R.string.language_russian_alphabet,
        new WordConverter.WordOperation[]{
            WordConverter.WordOperation.OPERATION_ELIMINATE_ON_NUMBER,
            WordConverter.WordOperation.OPERATION_TO_UPPERCASE,
            WordConverter.WordOperation.OPERATION_STRIP_ALL_DIACRITICS,
            WordConverter.WordOperation.OPERATION_STRIP_NON_ALPHABET_CHARS,
            WordConverter.WordOperation.OPERATION_VALIDATE_SIZE}
    );

The array of WordOperations specifies a list of actions to be performed by each word candidate, to convert and verify.

The alphabets also serve another purpose. It could happen that the 'best' puzzle has empty places, in this case they are filled with random letters from the alphabet, respecting their general frequencies

Playing field

The puzzle is played on a custom component. Depending on its final size, it determines whether or not to flip the puzzlegrid. Landscape generally is better suited for more columns than rows.

The custom view tracks where the player presses a finger, and when it is released, it figures out which letters are below it. The list of available words is then checked to see if it was a valid word.

If this is the case, it ultimately informs the containing Activity which then handles things like marking the word as found, in the wordlist.

In action

Statistics

Wordsearch Plus uses Google Analytics to keep track of how many daily players it has, and how they use the app. Using these statistics, we can see that at least 51 million seconds have been spent playing. Which amounts to 590 days pure playtime, since April 11th, 2013.

New version

The new version will make use of our own custom backend, removing the need to sometimes tell the user that a puzzle cannot be created.

Get it on Google Play

Download on the App Store