Klondike Solitaire
For Casio MicroPython 1.9.4 on:
	Casio fx-9570GIII, Casio fx-9860GIII, Casio Graph 35+ EII
Programmed by Jeffry Johnston
Version 1.0: 2022-08-30

====
Goal
====

Move all cards from the waste and tableau to the foundations, so that each
foundation pile shows a King.

===========
Game Layout
===========
 __             __   __   __   __
|  | <- Waste  |  | |  | |  | |  | <- Foundation piles
|__|           |__| |__| |__| |__|
 __   __   __   __   __   __   __
|  | |  | |  | |  | |  | |  | |  | <- Bottom card of each Tableau Pile
|__| |__| |__| |__| |__| |__| |__|
|  | |  | |  | |  | |  | |  | |  | <- Top card of each Tableau Pile
|__| |__| |__| |__| |__| |__| |__|

===========
Definitions
===========

"pile": A single pile (column) of the tableau
"foundation pile": A single pile (column) of the foundation
"bottom": the highest ranked card of a pile
"top": the lowest ranked card of a pile

==============
Klondike Rules
==============

General rules:
* Standard rules on https://en.wikipedia.org/wiki/Klondike_(solitaire)#Rules
  except: either a full pile or the top card of a pile may be moved,
          but not a partial pile.
* Single deck.
* The stock and waste piles have been combined into a single waste.
* Cards are turned onto the waste one at a time.
* Unlimited passes are allowed through the waste.

Foundations:
* A card may be moved to a foundation pile if it is an Ace, or:
  it is one higher than the rank of a foundation pile card and matches its suit.
* A card may be moved to a foundation pile from the waste or the top of a pile.
* Cards may not be moved from the foundations.

Tableau Piles:
* A card or pile may be moved from one pile to the top of another pile if:
  1) The "from" bottom card is a different color than the "to" pile top card.
  2) The "from" bottom card is one rank lower than the "to" pile top card.
* In piles 2 through 7 there are some hidden cards under the pile. Hidden cards
  are indicated by the top of a card being drawn above a pile. If there is more
  than one hidden card, dots will be drawn. The number of dots indicates the
  number of hidden cards.
* If all cards are moved from a pile, a hidden card (if there are any) will
  automatically be placed on the pile. Otherwise, the pile is empty.
* A card or pile may be moved to an empty pile if the bottom "from" card is a
  King.

Waste:
* A card may be moved from the waste to a foundation pile, following the rules
  for foundations.
* A card may be moved from the waste to a pile, following the rules for tableau
  piles.
* Cards may not be moved to the waste.

===========
How to Play
===========

The current game layout will be displayed graphically. Once you have determined
which move you wish to make, press [AC] once. A "From,To=" prompt will be
presented. "From" is the location number to move a card (or cards) from, and
"To" is the location number to move the card or cards to, separated by a comma.
Enter the desired move and press [EXE] to attempt to perform the move. No action
will be taken if the move is invalid.

Location     Number
--------     --------------------------
Waste        0
Piles        1 (left) through 7 (right)
Foundations  8

How to enter a move:
Move        Result
----        ------
(no input)  View the game layout again.
"           Show help.
0           Turn to the next card in the waste.
8           Move as many cards as possible from the tableau to the foundations.
            Warning: this saves a lot of typing near the end of the game, but
            can result in undesired card moves during the beginning and mid-game
            as uncovered hidden cards are also moved.
0,8         Move a card from the waste to the foundations.
0,1-7       Move a card from the waste to a pile. Example: 0,1
1-7,8       Move a card from the top of a pile to the foundations. Example: 5,8
1-7,1-7     Move a card or pile of cards from one pile to another. The game will
            first attempt to move the top card of the "from" pile. If that move
            is not allowed it will then attempt to move the entire pile.
            Example: 7,6
