[comp.lang.icon] Klondike card game, version 1.41. part 1/4

naz@hslrswi.UUCP (Norman H. Azadian) (12/06/90)

This is a new version of the solitaire card game that I posted some
months ago.  This one improved ICONisms, an improved user interface,
and a much better chance of actually running on any ANSI terminal.
There is even a man page, klondike.man, included in this message.

The source is now split into three files:

	klondike.icn	main program, top-level user-interface routines
	kloncon.icn	console I/O subroutines
	klonsub.icn	assorted other subroutines

To execute from scratch, I believe the following suffices:

	icont -c kloncon klonsub
	icont klondike
	iconx klondike  <<any options here>>

Should you wish to peruse the source, use a tab interval of 4, not 8.

NHA
---
PAPER:  Norman Azadian; Ascom AG; Belpstrasse 23; 3000 Berne 14; Switzerland
X.400:  naz@hslrswi.hasler
UUCP:   ...{uunet,ukc,mcvax,...}!cernvax!hslrswi!naz
VOICE:  +41 31 63 2178            BITNET: naz%hslrswi.UUCP@cernvax.BITNET

--------------- cut here -------------------- cut here ---------------------

    NAME
        klondike -- one of the many versions of solitaire

    SYNOPSIS
        klondike  -[ACD]  [-B gameCount]  [-R randomSeed]

    DESCRIPTION
        This is actually a popular variation on the Klondike version of
        Solitaire (or Patience) as described on page 181 of my 1963
        version of "Hoyle's Rules of Games".  The difference is that
        here we go through the deck (stock) 3 cards at a time instead
        of one-by-one, and we allow it any number of times.

        It should run on any ANSI-compatible terminal, but it looks
        best on a PC, preferably color.

    OPTIONS
        Options may be either upper or lower case.  They may be given
        in any order.  Parameters follow their options with whitespace
	inbetween.  Each option must be given as a separate argument.

        -A      disables automatically putting uncovered Ace cards
                on the appropriate pile.  Note that, in any case, it is
                not allowed to put an Ace onto a stack, as this could lead
                to building stacks which are too big to display with 25 lines.

	-B count
		Batch mode.  The requested number of games is played and
		the average number of cards promoted to the ace piles is
		written to the standard output.  No other I/O is performed.

        -C      disable the "click" for silent games

        -D      enable special debugging commands which, among other things,
                allow one to cheat

        -R seed
		set the random seed to the designated value

    COMMANDS
        H or ?  display a Help screen

        ^L      (control-L) redraws the screen

        A       Automatic mode.  Plays the game until nothing useful
		remains to be done, or until any key is struck.

        B       Boss key.  The screen is blanked and the current position
                is saved.  When the game is started again in the usual
                way, this saved game will be automatically restored and
		the save file deleted.

        C       Continuous mode.  The computer plays games automatically
                until a key is struck.  Two statistics are displayed:
                the number of games already played, and the total number
                of aces which have been promoted to the ace piles.

        M       Move a card from the deck or a stack to a stack or an
                ace pile.

        Q       Quit this game, with the opportunity to play another.

        S       Suggest a possible move.  Hitting this key multiple times
                results in multiple suggestions being displayed.  When
                there is nothing interesting left to do, it will suggest
                "Thumb".

        T       Thumb.  Remove the top 3 cards from the face-down deck
		and lay them face-up on the face-up deck.

        U       Undo.  This can be used all the way back to the start
                of the current game.

        Z       Debug.  This is only enabled when the -D option has
                been given on the command line.  There is a sub-menu
                of commands available, including a (very brief) Help
                summary.

        The Move command takes two parameters: source and destination.
        Possible sources are:  D for the Deck of face-up cards; and a
        number from 1 to 7 inclusive, meaning the corresponding stack.
        Possible destinations are the stacks (1-7) and A for the
        appropriate ace pile.  For instance, to move the visible card
        from the face-up deck to stack 4, one types the three characters:
        "MD4".  Actually, the "M" character itself is optional, which
        explains why the "debug" command isn't invoked with a "D".

    BUGS
        Slow.
        Doesn't use termcap for maximum portability.
        The program's play is simplistic, with no concept of strategy.


    FILES
        klondike.sav    Position is checkpointed here when the Boss key is used.
        klondike.sv?    Position checkpointed here with the "S" debug command.
                        "?" can be any (upper-case) character legal in your
                        filesystem.

    ACKNOWLEDGEMENT
        The inspiration, name, and user interface were lifted
        wholesale from a game copyrighted in 1985 by Allyn Wade.

    VERSION
        1.41 -- 26 November, 1990

    AUTHOR
        Norman H. Azadian
        naz@hslrswi
-- 
PAPER:  Norman Azadian; Ascom AG; Belpstrasse 23; 3000 Berne 14; Switzerland
X.400:  naz@hslrswi.hasler
UUCP:   ...{uunet,ukc,mcvax,...}!cernvax!hslrswi!naz
VOICE:  +41 31 63 2178            BITNET: naz%hslrswi.UUCP@cernvax.BITNET