Patience
games: How is a '.pat' file (patience game definition) structured?
The file extension is .pat and the name must not contain hyphens (-) but very
well spaces.
The cards are laid in 'piles'. The first pile is the stock from which all
cards are taken and dealt.
From the stock, they are maybe laid on the wastepile or elsewhere.
The cards must most often end on foundation piles if the patience is won.
Cards in the foundation piles start from the same foundation value (ace = 1..king = 13).
In some games, however, you must remove all cards from certain piles.
Each pile is described by 11 numbers in a LINE.
Some numbers are divided into digits with different meanings.
A .pat file is a text file, and looks like
this:
NAME
<appears in the window bar
n m
<number of games (1-8) each of 52 cards, number of piles.
n x y v w ba e f g
h i <FIRST the stock ... mandatory.
n x y v w dcba e ccba edcba baa dcba <all other piles ... up to 150 piles
including
1 2 3 4 5 6 7 8 9
10 11 the stock. The order is unimportant, with
certain exceptions.
For each pile, some questions must
be answered:
The layout
number How many cards will be laid out?
(1) n For the stock it is: 52*number of decks, other piles:
number of cards dealt.
If cards are redirected to the
pile during the dealing, it may well come to
contain more cards than n
indicates.
Where should the pile be
located? (The card images are 71x96 pixels.)
(2) x The X coordinate in pixels for the top left corner of
the pile (from left).
(3) y The Y coordinate in pixels for the top left corner of
the pile (from above)
A pile is not seen if
the Y
coordinate is -99 or less.
How should the cards be
placed in the pile?
(4) v The cards are
spread v pixels in the X
direction each.
(5) w The cards are spread w pixels in the Y direction
each.
(6) dcba How should the cards be laid on the pile?
a = 0: All cards show the back.
a = 1: All cards show the back except the
last one.
a = 2: All cards show the image.
a = 3: Back and image changes, first card
shows the back.
a = 4: Back and image changes, first card
shows the image.
a = 5: The cards are invisible (eg if
removed from the table).
a = 6: All cards show the back except the
last 2.
a = 7: All cards show the back except the
last 3.
The stock can have a=0 or 2. If a=2, cards can be drawn from it.
b = 0: Vertical cards (most frequently).
b = 2: Horizontal cards.
c = 0: stock only: All cards in it are
shuffled before being dealt.
c = 1: stock only: The decks are
shuffled separately before being laid out.
c = 2: stock only: Reshuffle after cards
have been put at the bottom.
c = 6: The foundation pile value is determined
by the first card laid out.
The number (1) must be 1, for the following piles with c=6: (1)=0.
Only the first card is dealt. There may well be several foundation values.
c = 7: Cards are taken out of the stock
and laid here. (1): How many,
(10): which cards. Also for unwanted cards, where the Y-coordinate
then should be -99 (the pile is invisible).
c = 8: as c=7, plus the cards are
put at the stock's bottom after the deal.
d = 0: From here: Cards ending elsewhere
are replaced from the stock.
d = 1: From here: Cards ending elsewhere
are NOT replaced.
d = 5: To here: A maximum of 1
card that fits eg ace, during the distribution.
d = 6: To here: Several cards
that fit fex. ace,2,3.., during the distribution.
d = 7: To here: Several cards
that fit, also from all free cards in the piles.
The game
How many cards must/may be in the pile?
(7) e 999: No matter. Goes also for the stock.
0-998: For foundation piles: how many cards if
the game is won (mostly 0 or 13).
If there are piles with 0 and with 1-998, it is the piles with 0
that determine when the game will be won.
negative: For certain piles: how many cards there may be, eg
–3 = 3 cards.
Also recommended where only one card (-1) may be placed.
______________
| For the
stock, numbers 8-11 mean:
|
|(8) f How many cards are drawn each time? (0 or
often 1-3).
|
|(9) g How many times can the stock be drawn? (most often 1-3 times,
999=unlimited).
|
|(10) h What happens when the stock is
exhausted and turned over?
| h=0: nothing (most frequently).
| h=1: the stock is split and shuffled.
|(11) i Which pile is
the wastepile?
|_____________Most often pile no. 2, If there is no wastepile, the number is =0.
For all piles other than the stock, numbers 8-11 mean:
(8) ccba How to move cards FROM the pile (and a little more, +
special functions).
a=0: No card may be taken.
a=1: A single card may be taken
each time.
a=2-3: Single cards and sequences may be
taken.
a=4: Only sequences may be
taken(2 cards or more). The sequence is defined by(11).
a=9: No rules, any collection of cards
may be taken.
b=1: A card cannot be picked up
if cards in other stacks partially covers it.
b=2: Cards cannot be laid down if
".
b=3: Cards can neither be
picked up nor laid down if ".
b=4-6: Like b=1-3 but blocked when: There are
cards in the next pile.
b=7-9: Like b=1-3 but blocked when: There are
cards in the next + the previous pile.
cc: (0-79), consists of a
mark (1-4, 0=none) and a mask (1-15, 0=none).
If the pile has a mask, it can not receive cards from piles which
have marks that fit with this mask. The pile itself may also have a mark.
cc=mark+5*mask. The mark can be 1,2,3,4 and must be added to the mask:
5
* mask: 0 5
10 15 20
25 30 35
blocks mark - 1
2 1+2 3
1+3 2+3 1+2+3
5
* mask: 40 45
50 55 60
65 70 75
blocks mark 4 1+4
2+4 1+2+4 3+4 1+3+4
2+3+4 1+2+3+4
(9) edcba How to move cards TO the pile (+ any special functions).
a=0: Lay no card.
a=1: Lay one card.
a=2: Lay a sequence
as a whole (as in Klondike).
a=3: Lay a sequence
as single cards via empty places (as in Napoleon).
a=4: Lay a sequence, 2 cards or
more.
a=5: Lay a sequence,
just 2 cards.
a=9: Lay a sequence,
just 13 cards. (mostly ace...king)
b=1/2: The pile receives 1/2
cards from the stock when the stock is clicked.
b=3/4: The pile receives 1/2
cards from the stock when the stock is clicked,
but only if there are cards in all piles of this kind.
b=5: Fill the pile
from the stock (type=(10)) when the stock is clicked.
c=1/2: Move 1 card from bottom
to top if it fits, one/many times.
c=3/4: Move 1 card from bottom
to top, unconditionally, one/many times.
d=1: The pile only
receives cards from the stock/wastepile.
d=2: If empty: only
cards from the stock/wastepile, otherwise from ALL piles.
d=3: If empty: only
cards from the stock/wastepile, otherwise from all OTHER piles.
d=4: If empty:
from ALL piles, otherwise only cards from the stock/wastepile.
d=5: Not cards from
the stock/wastepile.
d=6: If empty: only
cards from the previous pile.
e=1: Receives cards
only if there are cards in the previous pile.
e=2: Receives
cards only if there are cards in the next pile.
cards can only be moved if all conditions a, d and e are met.
(10) baa Which card may be laid on the pile when it is empty?
999=any card, 0=no card
may be laid. Else it is:
aa: card value: 1=ace..13=king, 99: no matter.
b=1: hearts.
b=2: spades.
b=3: diamonds.
b=4: clubs.
b=5: red (hearts/diamonds).
b=6: black (spades/clubs).
b=9: the color does not matter.
(11) (d)cba Sequence definition: Which card (or the bottom card in a
sequence)
may be laid on the top card in a not-empty pile?
999 = Any card, 0=no card may be laid.
Else it is:
The order of the values:
a=1: the sum of the values
must be 13, but the king can be moved by itself.
a=2: the sum of the values
must be 14.
a=3: the values must decrease
by 2.
a=4: the values must decrease
by 1.
a=5: the values must be the
same.
a=6: the values must increase
by 1.
a=7: the values must increase
by 2.
a=8: the values must increase
or decrease by 1.
a=9: no conditions.
Can a sequence continue beyond the ace/king limit?
b=0: No.
b=1: Yes, both ways.
b=2: No, and no card may be
laid on a king.
b=9: no conditions.
The order of the colors:
c=1: Same color (spades on
spades etc.).
c=2: Red on red and black on
black.
c=3: Alternating colors (red on
black and black on red).
c=4: Any other color (eg hearts/spades/diamonds on clubs).
c=9: Color doesn't matter.
Advanced (more than one set of rules:
d: If d> 0, 4 more
numbers follow after (11). See 'Advanced'.
Advanced.
The size of the program window depends on where the piles are placed in the layout.
If more space is needed to the right or bottom, you can place an empty pile, only
used for increasing the size of the window, eg:
0 607 413 0 0 0 0 0 0 0 0 0 (at least 607+71 horizontally, 413+96 vertically).
--------------------------------------------------
-------------------------------
It happens (seldom, luckily) that two sets of rules are needed to describe
the behavior of a pile. For example in 'The Spider' where you can build on two
kinds of
sequences. This is solved here by adding 1000 to number(11) and letting number
(8) to (11)
from rules 2 follow in the same line. It may look like this:
6 4 4 0 16 1 0
1 32 999 1304 2 2 999 104
(take 1 card (1), add sequence (32), build 1 downwards in alternating color (.304)) OR:
(move sequence/single card (2 2), build 1 downwards in the same color (104)).
The number that may be added to number (11) is in whole thousands:
1000: Use rules 1, and if the move is rejected, rules 2.
(1 OR 2)
2000: Use rules 1, and if the move is accepted, rules 2.
(1 AND 2)
3000: Use rules 1. When the last drawing starts, rules 2.
4000: Use rules 1. When the last drawing is over, rules 2.
5000: Use rules 1. When drawing the last card(s), rules 2.
6000: Use rules 1. When the first drawing is over, rules 2.
>6000: Use rules 1.
Example:
Mysteriet
(name shown)
2 34
(2 card decks, 34 piles)
104 4 4 0 0 0
999 1 999 0 2 (1) (stock)
0 4 108 0 2 2 999
1 0 0 0 (2) (wastepile)
(blank line for clarity)
1 83 310 0 16 2 999
1 2001 999 114 (3)
1 83 202 0 0 0 999
31 0 0 0 (4)
5 83 108 0 1 2 999
1 0 0 0 (5)
1 83 4 0 0 602 13
0 1 999 116 (6)
1 162 310 0 16 2 999 1
2001 999 114 (7) <repeat 6 times more
1 162 202 0 0 0 999 31
0 0 0 (8) <with other
5 162 108 0 1 2 999
1 0 0 0 (9) <X coordinates
0 162 4 0 0 602 13
0 1 999 116 (10)
. . . . . . . . . . . . . . . . . . . . . . .
n x y v w abcd e
iiLf smjot kuu pqr
(1) (2) (3) (4) (5) (6) (7) (8) (9)(10)(11)
----- layout ----- -------- game ---------
The layout.
The stock: 104 cards initially, in(4.4), no
offsets (0 0), back
up (... 0).
Any number of cards in the pile(999), draw 1 card(1) each time,
exhaust the pile indefinitely(999), The wastepile is no. 2.
The wastepile: No cards, in (4,108), offset 2 pixels downwards, image up
(..2),
Any number of cards in the pile(999), take 1(1), lay nothing(0), no rules(0
0).
Pile 3: 1 card, in
(83,310), offset 16 pixels downwards, image up (...2).
Pile 4: 1 card, in
(83,202), no offset, back up (...0).
Pile 5: 5 cards,in
(83,108), offset 1 pixel downwards, image up (...2).
Note that pile 5 partially covers pile 4 (202-108 = 94).
Pile 6: 1 card, in (83.4),
no offset, image up. This card determines the value
from which the foundation piles are to be built (.6..).
This Foundation Value also applies to the corresponding piles (no. 10, etc.)
where (6)=.6.., and where no card is placed during the dealing.
The game.
stock: Number of cards does not matter.
Must be drawn to the wastepile (1) card
each time, unlimited times (999). Nothing special happens when turning(0).
wastepile: Number of cards does not matter. 1
card may be taken each time (...1) but
no card may be laid here (....0) (except of course from the stock).
Pile 3: Number of cards
does not matter. 1 card may be taken (...1), but only
cards from the wastepile may be placed here
if the stack is empty (.2...). No.(10) is 999 because any such card
may be used. You may build 1 downwards (..4) in the same color (1..),
and the ace-king limit may be exceeded (.1.).
Pile 4: Number of cards
does not matter. One card may be taken (...1) but not laid
(....0). However, the card may only be taken if no card in the following
pile(here pile 5) covers it (..3., special function). Numbers 10-11
are zero, as no cards may be placed here.
Pile 5: Number of cards
does not matter. Cards may be taken (...1) but not laid(....0).
Pile 6: 13 cards here if
the game is won. Cards may be laid but not taken.
Number(10)is 999 (whatever) which is changed to the foundation value as no.(6)
is .6.. Build 1 upwards (..6) in the same color (1..), past king (.1.).