Teun.ToString()

by Teun Duynstee [Macaw]

<October 2008>
SuMoTuWeThFrSa
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678


Navigation

Subscriptions

News

I discontinued this blog. I now post at: www.TeunToString.net



Download Finch PocketBlogger

Post Categories

Article Categories



WordBlock: Modifying and Extending

There are a number of ways to extend and configure WordBlock. We will treat them here in order of technical complexity. We start with the easiest tasks and will end with the kind of extensions that require real programming skills.

Changing the dictionary

One of  the most obvious things you may want to change is the dictionary used in the game. It can be frustrating playing against a computer that uses exotic and archaic words in the game or denying you points for words that are perfectly normal words. So you may want to add or remove words in the dictionary.

Another reason for changing the dictionary would be to allow you to play in your own language. WordBlock comes with an English and a Dutch (my mother tongue) dictionaries. If you own a large list of French words, it is very well possible to have WordBlock work in French.

When you are connected to your Pocket PC through ActiveSync, you can use Windows Explorer to view the files in the Finch installation directory. You will see that it contains files named words2.txt, words3.txt, up to words6.txt. Words2.txt contains all valid 2-letter words. You can copy the files to your desktop and open them with Notepad or your text-editor of choice. Every line contains one word. In the dictionary files that come with wordblock, the words are in alphabetical order, but this is not strictly necessary (it makes it easier to maintain though).

The file is encoded as UTF-8. Many text editors will recognize this automatically (Notepad on Win XP does). If the first line starts with 2 strange characters, your editor doesn't recognize the encoding. Use another editor.

You can add or remove lines as you like. Do not add 3-letter words to words4.txt though.

Capitals and accented characters

In the game, the player can only use the plain letters a to z. Only lower case. Some words may contain accented characters or should be spelled with a capital. The rule in the game is that a letter 'e' can be used in words in all accented and capitalized forms (e, é, è, ê, E, È, É, Ê, Ë, etcetera). In the word list, these words are presented twice on one line, first lowercase without any accents, then a space and then the form with casing and accents. This second form will show up in the list of formed words at the bottom of the screen. So if you want to add the word URL to the list, you add this line to the word list:

url URL

and if you want to create a Spanish version, you would have a line like this:

pena

but no line for the word 'peña', because it would double with 'pena'.

Changing the avatar images

Standard, WordBlock comes with 4 little icons to represent the players. The standard icons are based upon characters from Star Trek. Should you want to add your own icons, this is very well possible. Again, with the PPC connected to ActiveSync, you can copy your icons to the WordBlock application directory. Once you have added the images, you have to tell Wordblock to use them. Copy the config.xml file to your desktop and open it using a text editor. You will see a number of lines like this one:

By changing guy.gif into the name of your new image (and maybe changing "You" into another name, you are set. Just copy the xml file back to your device and start a new game.

Changing the number, playing order and strategies of the players

As you saw in the previous paragraph, config.xml contains the details on all players in the game, both AI players and the user. You can add extra players or play with less competitors. You can change the strategies of all players as you like. The interactive player (the user) should always use the PocketWordBlock.Strategy.UserStrategy strategy. You cannot have multiple players for the UserStrategy.

Of the built-in strategies, the strongest is the OptimizingLongWordStrategy. You will find that it is very hard to win from a set of computer-players that all use this strategy. If you configure, on the other hand, only players using SimpleLongWordsStrategy, you should be able to win. If that too turns out to be too difficult, there's also a built-in RandomStrategy. This strategy just picks random letters and puts them on random locations of the board.

Creating your own strategy

[to be done]

Actually, I do not really expect anyone to do this, but if you want to give it a try, mail me and I will be happy to explain all the details.

posted on Friday, January 21, 2005 12:54 PM by TeunD





Powered by Dot Net Junkies, by Telligent Systems