Input


The program will take in as input a text file describing how to play a specific solitaire game. The available keywords are as follows (case insensitive). Whitespace is ignored. Note: This was developed before the desicion to go to XML although the components should be the same.

 

Top Level Codes:

Header

Starts a block giving information about the game to the player.


Setup

Starts a block describing the game elements needed.


Deal

Starts a block giving the initial state of the game


Move

Starts a block listing legal moves


Deck

Starts a block giving the deck type used


Finish

Starts a block giving the victory state


Elements:

Tableau

Foundation

Stock

Reserve

Wastepile

Remove

In the setup these indicate that game element is needed. Each element should be paired with a command giving the number and the type of display. In other blocks these codes restrict the scope of the other codes.



Header:

Name

Gives the name, in parenthesis, of the solitaire game.


Description

Gives a brief description, in parenthesis, of the game.


Height, Width

Gives recommended dimensions for the window.



Setup Syntax:

<Element> <Setup Code>{[integer]}

The integer is option and defaults to one if omitted.

            ex. Tableau MixDropStack[7]


Setup Codes:

Back

One card face down


Face

One card face up


DropStack

A stack in which every card shows the top portion


MixDropStack

Similar to the DropStack except some cards may begin face down


TopStack

A stack with only the top one showing


BackStack

A stack with only the back of the top card showing



For these types an optional number in brackets (e.g. [4] ) may be appended. If left off it is assumed to be only one.


Move Syntax:

<Element> <Move item> <Destination> {Move Modifier}

            ex. Tableau ValidStack AltColor Descending


Move Item:

Any[x]

Moves x cards. Default value of x is one and the code Any is assumed to be Any[1].


FullStack

Moves the entire stack of cards.


ValidStack

Can move a group of cards that follow the given move rules.


SingleCard

Can move one card.


Destination Codes:

AltColor

Can move a card to one of the opposite color


SameColor

Can move a card to one of the same color


SameSuit

Can move a card to one of the same suit


AnySuit

Can move a card of any suit.


Any

Can move any card.


Rank[r]

Can only move a card of rank r (one of A..K) here


OnBlank

Move rule only applies if position is blank


Move Modifiers:

ThroughReserve

Can move a group of cards that follow the move rules so long as there are enough positions open in the reserve.


Ascending

A card must be placed on one of a lower rank


Descending

A card must be placed on one of a higher rank


SourceElement[x]

The move item must originate in element x.


NotValid

The move while legal does not count towards a valid stack.


Deck Codes:

Single

one standard deck


Multiple[x]

x standard decks


<Suit>[x]

x copies of Suit cards only

            ex. Spades[8]


KingHigh

The king is the highest ranking card


AceHigh

The ace is the highest ranking card


Cyclic

There is no highest card instead after the king comes ace then 2 and so on.


Finish Codes:

TableauEmpty

No cards left in the tableau


AllInFoundation

All cards are in the foundation


SingleStack

All cards are in one stack


Deal Codes:

The deal order for each element is in braces with each stack in its own element. Example

{1,3}{2,4} would deal four cards into two piles. For the MixDropStack face down cards have parenthesis around them so {(1),3}{(2),4} would deal four cards with the first two face down and the second two face up. Any elements not listed will be considered empty and any cards not dealt will be placed in the stock.


Initial

The following deal order is performed at the start of the game.


Triggered[x]

The following deal order is performed at the players request up to x times.


TriggerConditions

Starts a block to give condition under which a triggered deal may occur.


NoValidMove

Trigger if no moves may be made.


NoBlank[x]

Trigger if none of element x is blank


Example file


Header

Name "Klondike"

Description "Standard solitaire game."



Setup

Tableau           MixDropStack[7]

Foundation     TopStack[4]

Stock              BackStack

Wastepile        TopStack


Move

Tableau ValidStack AltColor Descending

Tableau Rank[K] OnBlank

Foundation SingleCard SameSuit Ascending

Foundation Rank[A] OnBlank

Wastepile Any[3] Any SourceElement[Stock]

Stock FullStack OnBlank SourceElement[Wastepile]


Deck

SingleDeck

KingHigh


Deal

Initial

Tableau {1}{(2),8}{(3),(9),14}{(4),(10),(15),19}{(5),(11),(16),(20),23}

{(6),(12),(17),(21),(24),26}{(7),(13),(18),(22),(25),(27),28}


Finish

AllInFoundation