SiteExperts.com Logo Home | Community | Developer's Paradise | Jobs
User Groups | Site Tools | Site Information | Search

Inside Technique : Using the Explorer Solitaire library : Creating the game page

The task of writing a game page is ridiculously simple if you want to stick to the default functionality of the Explorer Solitaire library. Simply copy the Standard template below into a new file, change the values marked in Bold to the name of your game, and voila - you have a fully functional game on your hands.

<HTML>
<HEAD>
<TITLE>Canfield</TITLE>

<object id="Rules" classid="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83" 
align="baseline" border="0" width="0" height="0">
<param name="UseHeader" value="True">
<param name="DataURL" value="canfield.sol">
<param name="TextQualifier" value="&quot;">
<param name="Sort" value="Type">
<param name="Filter" value="">
</object>

<SCRIPT LANGUAGE="JavaScript">
function CustomScript(){
}
</SCRIPT>

<SCRIPT LANGUAGE="JavaScript" SRC="SEXES.js" 
onreadystatechange="CustomScript();"></SCRIPT>

<SCRIPT LANGUAGE=JavaScript FOR=Rules EVENT=ondatasetcomplete>
LoadGame();
</SCRIPT>

</HEAD>

<BODY>
<TABLE STYLE="display: none" DATASRC="#Rules">
<TR>
<TD 
DATAFIELD="type"></TD></TR></TABLE>

<DIV style='position:absolute;color:gold;background-color:black;font:8pt 
Arial;left:0pt;top:530;width:100%;text-align:center'>

Press <B>F1</B> for help. This game was designed using Rajeev 
Hariharan's <B>Explorer Solitaire</B> library. &copy;1997-99 
<A STYLE="color: gold" HREF="http://www.siteExperts.com">InsideDHTML.com, 
LLC</A></DIV>

<DIV ID="zone"></DIV>

<DIV ID="floater" style="position:absolute; 
cursor:hand;left:0;top:0;visibility:visible"></DIV>

</BODY>

</HTML>

Heaving a contented sigh, you dash off your game to Mr. Conner, with a note telling him to get your payment ready. But it's never that easy, is it? Conner's reply states that, while the game behaves like he expected, there is one drawback. Empty Tableaux piles should be filled automatically from the Reserve pile, if there are any cards left in the Reserve. If the user can choose his own foundation base card in the beginning stages of the game, then the chances of his winning increase dramatically. And, while the House does like people to win once in a while, we wouldn't want that to become a regular feature would it?

And what about scoring. The customer will expect to see his current earnings on screen won't he? Surely you don't expect him to calculate the numer of cards on the Foundations by himself.

The Explorer Solitaire library does not inherently support the functionality desired by your client. But you can use a technique known as Function Overloading to implement it anyway. In the next page, we will take a look at how this works.