Developer's Daily Java Applets
  front page | java | perl | unix | DevDirectory
   
Front Page
Java
Applets
   
The "WordJumble" applet - version 1.0

Description

We first created this applet when trying to solve a "Word Jumble" in our local newspaper. One of the combinations of characters didn't seem to create any words at all, so we wrote this applet just to try to solve that combination (hardly worth the effort, but it was an interesting technical challenge).


Don't know what a WordJumble is?

In a Word Jumble game you're challenged to see if you can convert a scrambled sequence of letters like this:

lasia

into a word like this:

alias

Word Jumble's are often found in local newspapers. They usually consist of five to six scrambled words, and then one master word or phrase at the end.


The challenge of the WordJumble applet

The challenge of this applet comes from the fact that the number of characters in the Jumble is variable. It's usually 4, 5, 6, or even 7 characters.

In a Java program, this means that you can't have simple nested for loops. Fro instance, if you knew that there would be only 5 characters in each calculation, you could easily create a solution with five nested loops. But in this case, a variable number of input characters requires a variable loop solution. This led us to a recursive programming solution. (Recursion is the process of a method calling itself repeatedly to solve a problem.)


Problems with this applet

(1) We didn't spend any time on this applet trying to create a user interface that would work on all platforms. We just laid components out at various x-y coordinates that looked okay. If we were more concerned about the appearance, we'd probably use a GridBagLayout to make the applet more portable, but really, the challenge of this applet is the calculation engine, not the interface. In summary, the applet should look fine in Netscape Navigator browsers, but we haven't tested it with Microsoft's Internet Explorer.

(2) A second problem is that when you enter seven or more characters, the calculations begin to take a longer time. It's not actually the calculations that take long, but displaying the results in the TextArea. We've taken some steps that really improve the performance of the calculations.

(3) The last improvement we could use at this time would be the addition of a dictionary or spell-checker to the applet. If we could include this type of spell-checking engine, the number of characters the user enters would be irrelevant.


See it in action

Click here to see the WordJumble applet in action

Java source code and class files

The source code for the applet consists of two files that you should download:

If you'd rather just download the class files, you can download those (using Netscape) by right-clicking on these links, and choosing the "Save Link As..." option:


404 - page not found

return to alvinalexander.com