Phone development: hiccups

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.

We are writing our app in JavaScript, HTML and CSS. The plan is then to embed that in a browser in an app on a phone by using a project called PhoneGap, which lets us use the same code on all phones, instead of writing phone-specific native code (Android uses Java, iOS uses Objective C, then there’s Bada, Symbian, and others to consider).

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.

recursion

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.

Leave a Reply

Your email address will not be published. Required fields are marked *