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

Inside Technique : Using the Explorer Solitaire library : Defining Game Parameters

Now that you've played the game, and earned a bit of cash in the process, the next step is to write the game. The game essentially consists of 2 files. The data file, canfield.sol, holds the parameters of the game and of individual cardpiles within the game. The actual game page is canfield.htm, which will contain the Tabular Data Control that accesses the data file, as well as custom scripts that override the default behaviour of the Explorer Solitaire library.

The first step towards creating the data file is to define the parameters of the game. Explorer Solitaire supports the following parameters-

Deck Type
This could hold the value "1" for a single-deck game, or "2" for a two-deck game (104 cards). Since Canfield is played with one deck, you set this parameter to "1".
Deck Position
The x and y co-ordinates of the deck's position on screen. This parameter is set to "10,10" to position the deck at the top left corner of the screen. Note that in some games like Yukon, the deck contains no cards, since all of them have been dealt out to the cardpiles. In such cases, you would set the y co-ordinate of the deck to "-100", to hide it from view.
Deal
The number of cards dealt when the deck is clicked. This is usually either "1" or "3", but the library does not prevent you from using another number. For Canfield, this value is set to "1".
Redeals
The number of redeals the game permits. Set this value to 0 for No redeals, 1 for a single redeal, etc. Since Canfield permits unlimited redeals, we set this value to "-1".
Structure
The way the deck is painted on the screen. The library allows three type of structures, Packed, where the cards are painted one on top of the other, so that only the top card can be viewed, Vertical, where the cards are painted one below the other, and Horizontal, where cards are painted, well, horizontally. Decks and Foundation piles are usually Packed, while Tableaux are normally Vertical (pun intended:-). The value of this parameter can be "P", "V", or "H". The structure of the Canfield deck is defined as "P" for Packed.
EmptyGIF
The GIF file to display when the deck is empty (i.e. holds no cards). Do not include the extension ".gif" in this parameter. For Canfield we define this to be "O", which represents the o.gif file included with the Explorer Solitaire library.
Win Screen
The HTML or ASP page to display when the user wins the game. This parameter is set to "winner.htm", the default Win Screen of the library, but, if you're feeling adventurous, you could design your own custom screen with playing-card animations using the SiteExperts DHTMLLib CSS positioning library.
AutoTarget
The Pile Type of the cardpile that receives cards when the deck is clicked. In Canfield this parameter is set to "PW", which is the Pile Type defined for the Waste Pile (More on this in the next page).

That's it! But hold on, don't reach for that Bud yet, there's still a little more work to be done. You will now have to set the cardpile parameters individually for each cardpile within the game.