How the Fun 'n' Games Page Works
Functional Overview
The Fun 'n' Games page provides a very simple word search game. First the square is generated by a server-side
Java component and displayed. The user can then select cities. Once the user has selected a city
at the bottom of the screen, the user is prompted to enter the X and Y coordinates of the hidden word in the matrix.
The prompt is dislpayed using Dynamic HTML (DHTML).
The game finishes when all the cities are correctly identified.
Components Used
A Java component called Hidden.Words generates the matrix of letters and cities.
The component is made from three classes: HiddenWords, SquareElement
and ChosenWord.
Class | Comment |
HiddenWords
|
The main class. This is exposed by COM, so it can be called from ASP.
This class has the following public methods:
buildWordSquare() and
getWordList()
|
SquareElement
|
Each character in the matrix is actually an instance of this class.
|
ChosenWord
|
All the chosen words are stored in a Vector of ChosenWords.
|
As noted in the table above, HiddenWords has three public methods. These methods are automatically exposed
by the Microsoft Java virtual machine (VM) as COM methods.
Method | Comment |
buildWordSquare
|
This method builds a random square of letters and then populates it with a random series of non-duplicate cities.
The words can go either across or down. Once it is populated, an HTML table is built inside the component and passed back
to the calling page, FunNGames.asp, through the ASP IResponse interface.
To make this easier, extensive use of the ASP Java Component Framework is used.
|
getWordList
|
Returns a list of words inside an HTML table, the result is passed back to the calling page,
FunNGames.asp through the ASP IResponse interface.
To make this work easier, extensive use of the ASP Java Component Framework is used.
|
|