When you get beyond simple development, it is sometimes a pain just setting up the tools in order to get things done.
We discovered that today when trying to set up a laptop for installing the app development environment.
However, installation is a pain. We need to download and install Eclipse, then download and install the Android SDK, then get Google’s ADT plugin for Eclipse, then download Phonegap (version 2.9.0 – version 3.0 sucks). All of that before we can get the phone to even say “hello world”!
So, while downloading that stuff, we carried on with the coding of the WordChain app.
Last week, we worked on simply creating the user interface – the buttons, etc, that would be shown to the player. We ended up with a simple system that showed a word at the top (cold), another at the bottom (warm), and let you fill in letters in between.
This week, we decided to have the app come up with random problems to be solved.
Sounds simple, right? Not so!
We couldn’t simply choose any two random words. What if there really was no possible solution?
So, we needed not only to choose random words, but also to verify for ourselves that it was actually possible to get from one word to another in only 4 steps using valid words.
We did this by using a “depth-first recursive algorithm“. That’s fancy-talk for “treat the problem as a tree, and use a simple set of checks at each ‘branch’ to find the solution”. Read the WikiPedia article for some examples.
The solution works, as can be seen in our demo. In Chrome, if you press F12 (in the demo), and choose the Console tab, you can see the word path that the app came up with as a solution. It’s in reverse order, but you can see the solution.
I’ve set some homework such that the app should be adjusted so that the player cannot input invalid words.