for klondike to actually be a game, rather than just a card pusher, we
need a few more abstractions; for me to like it, we also need some
features like automatic snap-to-location.
given a click, we get a card and a location. we need to use one of
these to figure out what the card can do. given the games we're
thinking of, generally a card on a given pile can move to other piles.
single card moves are always the top card; multi-card moves are always
the top n cards.
klondike:
- unseen deck
- this deck is all cards face down; after dealing out the hand, all
cards are placed here. Cards can only move from here to the play deck,
three at a time (though some variants allow one at a time.)
- play deck
- cards that arrive here are flipped face up. only the top card may
be played. It can be placed on top of any other card which has a value
one higher and an opposite color (either suit).
- play up piles
- these piles begin empty; an ace can be placed on any empty
square; any other card can only be placed on a card which has a value
one lower and the exact same suit.
- play down piles
- these piles are dealt originally. If the top card is face down,
it may be turned face up. If a pile is empty, it may have a king
placed on it. Any top card can be moved either to a play up pile or
onto another top card which has a value one lower and is of opposite
color. Any group of the top n cards can be moved on top of any other
card as long as the nth card has a value one lower and is of opposite
color of the card the pile is landing on.
Algorithmically (let's come up with the notation as we go...)
- unseen deck
- click: if empty, flip play pile; else move three to play pile.
- play deck
- card: faceup; click: top moveable;
- play up piles
- card: if (suit == top suit) and (card - 1 == top card) accept;
click:
- play down piles
- card: if (color != top color) and (card + 1 == top card) accept;
click: flipped moveable;
current todo:
- figure out how to select "all above on this stack"
- figure out how to iterate over the pile and flip it over
- figure out how to check if the top of the current pile is legal
- given that, figure out how to tally score