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

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

Setting cardpile parameters individually isn't as tedious as it sounds. Canfield has 4 different types of cardpiles, the 4 Foundation piles, the 4 Tableaux, the single waste, and the single reserve pile. Since all the Foundations behave similarly, and, for that matter, so do the Tableaux, you just need to set the parameters of a single pile, and copy them to the remainder. The only parameters which will differ are the x and y co-ordinates. Let us look at the parameters you can set for individual cardpiles.

Pile Position
The x and y co-ordinates of the pile in pixels. Similar to Deck Position, which was discussed in the previous page.
Pile Type
Holds the value "F" for Foundations, "P" for Tableaux, and "Px" for any other pile type, where x can be any UPPERCASE alphabet. In this case we set the type of the waste pile to "PW" and the reserve pile to "PR".
Structure
This parameter was discussed in the previous page
Face-down Cards
The number of face-down cards that the pile holds at the beginning of the game.
Face-up Cards
Similar to the previous parameter, but for face-up cards. Too simple, wot?
EmptyGIF
This parameter was discussed in the previous page.
Build
A 3 to 4 character string defining how the pile is built. We will discuss each of these characters.
  • The first Character is the Pile Base Card. This is the card that the user can play onto an empty pile. If set to "Y", the user can play anY card, and "N" means the user cannot build at all on an empty pile. You can also set this character to "X" for Fixed, which implements a Canfield Foundation like behaviour - The user can play any card as the base card of the Foundation, but once this card has been played, all other Foundations will only accept this same fiXed card as their base card. If you set the value of this char to "A","2","3",...."9","T","J","Q","K", then the pile will accept only that particular rank as the base card. For example, in Klondike (Windows Solitaire), the Foundation base card is "A", which means that only an Ace can be played on an empty Foundation.
  • The second Character is the Build Direction. A "U" denotes an upward build while a "D" denotes a downward build. For example, in Klondike, the Foundations have a build of "U" (only a 2 can be played on an A, only a 3 on a 2, and so on), while the Tableaux have the exact opposite build of "D"). You can also set this value to "B" for Both Up and Down, to implement a Fan Solitaire like behaviour where either a 3 or an A can be played on a 2. You could set this value to "N", which means building is Not permitted on this pile (as in Waste and Reserve piles), or "Y" which means any rank is permitted for building.
  • The third Character is the Build Type. Possible values for this character include "A" for Alternate Colour (Only a Red card can be played on a Black card or vice-versa), "C" for Colour (Red on Red, Black on Black), "S" for Suit (only a card of the same suit can be played e.g. the Klondike Foundations), or "R" for Rank (only a card of the same Rank can be played).
  • The fourth Character is optional and represents the Cut-Off rank of the cardpile. Once this rank has been played on the pile, no further building is allowed on the pile. In Klondike, for example, you don't want the user putting an A on top of a K in the Foundation, so you define the cut-off rank to be 'K'. (This scenario is possible in a two-deck implementation of Klondike like Gargantua).
Whew, that's it for the Build parameter. You'll get used to it as you see implementation examples. For example, in Klondike the Foundation build is defined as "AUSK", which means play an Ace on the empty foundation, then build Up in Suit till King. Similarly the Build for the Tableaux in Klondike is "KDA", or Play Kings on Empty Tableaux, build the Tableaux Down in Alternate Color. In Canfield, the Foundation build is "XUS", which means Foundations have a fiXed base card, then they are built Up in Suit. Canfield tableaux have a build of "YDA", or anY card can fill an empty tableau, but the build is Down in Suit. The Reserve and Waste piles have builds of "NNN", which means no building is permitted on them.
Grouping
This is a two Character parameter. Each Character can be set to either "Y" or "N" (Yes or No to the uninitiated:-) The first Character indicates if the pile is a Group Source (if Groups of cards can be dragged away from it), while the second indicates if it is Group Target (if Groups of cards can be dropped on to it). For example, in Canfield, the Foundations and Reserve pile have this parameter set to "NN", which means they are neither Group Sources nor Targets (only a single card can be moved at a time). The Tableaux of Canfield, on the other hand define this parameter as "YY", which means Groups of cards can be both dragged away as well as dropped onto them.
AutoTarget
Another two Character parameter with each character having "Y" or "N" values. AutoTargeting is the feature whereby you can double-click a card to send it to it's destination (most usually the Foundations). The first Character indicates if the pile is an AutoTarget Source (i.e. if it can be double-clicked), while the second shows if the pile is an AutoTarget target (i.e. it accepts double-clicked cards sent by other piles). The Foundations of Canfield have this parameter defined to be "NY" (they can't be double-clicked, but will accept double-clicked cards from other piles), while the Tableaux define this parameter as "YN" (they can be double-clicked, but will not accept double-clicked cards sent from another pile).
MaxLength
This final parameter is valid only for Foundations. It holds the maximum number of cards that a Foundation can hold. When all foundations hold their Maximum length, the game is considered won. In Canfield, all Foundations have a MaxLength of 13.

There, that wasn't so tough was it? Only 10 parameters in all. Still, if your head is spinning and your eyes are glazed, this would be the right time to grab that Bud and, if you're using IE5, listen to a Radio Station. In the next page we will show you how to define the game data file using the Game and Cardpile parameters you have just learnt.