Section C - Actions
To decide whether the player has won:
if there is a face-down card, no;
if there is an unplayed card, no;
let N be zero;
repeat with the stack running through piles:
if the stack is empty:
increment N;
next;
let the color be the suit of entry 1 in the contents of the stack;
repeat with the item running through the contents of the stack:
if the suit of the item is not the color, no;
if N is two, yes. [There must be two empty stacks, no face-down cards, and only one suit per pile.]
Every turn:
if the player has won, end the story finally saying "You have won";
show all the piles.
Moving it to is an action applying to one visible thing and one thing. Understand "move [any card] to [a pile]" as moving it to.
The moving it to action has a number called the number of cards moved.
Check moving a card to a pile:
if the noun is face-down:
say "You can't see [the noun] at the moment." instead;
let L be the cards on top of the noun;
if L is not empty:
let N be the number of entries in L;
let the old card be the noun;
reverse L;
repeat with X running from 1 to N:
let the new card be entry X in L;
let the difference be the face value of the old card minus the face value of the new card;
unless the difference is 1 and the suit of the old card is the suit of the new card:
say "You can only move a stack of cards when they form a descending run." instead;
now the old card is the new card;
unless the contents of the second noun are empty:
unless the suit of the noun is the suit of entry 1 in the contents of the second noun:
say "You can only move a card onto a card of the same suit." instead;
if the face value of the noun is greater than the face value of entry 1 in the contents of the second noun:
say "You can only move a card onto a card of lesser value." instead;
let N be the number of entries in L;
increment N;
now the number of cards moved is N.
Carry out moving a card to a pile:
let the stack be the holder of the noun;
move the top (number of cards moved) cards from the stack to the second noun.
Indirectly moving it to is an action applying to two visible things. Understand "move [any card] to [any card]" as indirectly moving it to.
Check indirectly moving a card to a card: if the second noun is face-down, say "You can't see [the second noun] at the moment." instead.
Carry out indirectly moving a card to a card: try moving the noun to the holder of the second noun instead.
Does the player mean indirectly moving a heart-suited card to a heart-suited card: it is very likely.
Does the player mean indirectly moving a diamond-suited card to a diamond-suited card: it is very likely.
Does the player mean indirectly moving a club-suited card to a club-suited card: it is very likely.
Does the player mean indirectly moving a spade-suited card to a spade-suited card: it is very likely.
Seeding the RNG with is an action out of world applying to a number. Understand "seed [number]" as seeding the RNG with.
Carry out seeding the RNG with a number:
seed the random-number generator with the number understood.
Report seeding the RNG with a number:
say "Random seed set."
Dealing is an action applying to nothing. Understand "deal" as dealing.
Check dealing when there is a played card:
say "A game is in progress. Are you sure you want to deal again? ";
unless the player consents, stop the action.
Carry out dealing:
deal the cards.
Drawing is an action applying to nothing. Understand "draw" as drawing.
Check drawing:
if the number of unplayed cards is zero:
say "There are no cards left." instead.
Carry out drawing:
repeat with the stack running through piles:
add 1 card to the stack.