
Commerce (ZCRD), version 1.0

  This is the game of Commerce, a three- to five-player game similar to Rummy,
played against two to four computer opponents. In a live game, you might use
tokens for betting and keep track of a pot; but in this version, there's no
automated scoring; the goal is simply to win more hands than your opponents
by luck and skillful play.


SYSTEM REQUIREMENTS

   3266 bytes to store prgmCOMMERCE, ZCMMV, ZCMEVAL, and ZCRD
  ~2000 bytes of free memory to run
  -----
  ~5300 total bytes

prgmCOMMERCE overwrites Str1, the equations Y1 and Y2, and lists L1, L2,
and L3. Make sure there's nothing important saved in those variables before
running the game.

PLAYING THE CARD GAME

  Commerce is a generic member of the family of "commerce" card games,
which includes Rummy and Kemps. The rules I used in this version come from
"The Book of Cards for Kids," by Gail MacColl.

  The deal rotates to the right. At the start of each hand, the dealer
shuffles and deals three cards face-down to each player, and three cards
face-up in the center of the table. The three center cards are called the
"widow". Before the start of the hand, the dealer is allowed to exchange
his whole hand for the widow, if he wants; this is to compensate for the
disadvantage of going last in the hand.

  Starting with the player on the dealer's right, each player in turn may
either exchange one of their cards with the widow, or "knock", signaling
that he's content with the cards he has. A player who has knocked is out
of the rest of the hand; he can't make any more exchanges.

  Once two players have knocked, the hand is over. All players reveal
their hands. The best hand of three wins (see below); if there is a tie,
then the player closest to the dealer's right hand wins. The dealer always
wins ties.


THE HANDS

  The best hand is a "tricon": three of a kind (e.g., three nines). Aces
are high.

  The next-best hand is a "sequence": a straight flush (e.g., five-six-seven
of clubs). Ace-two-three is the lowest sequence; Queen-King-Ace is the
highest.

  The next-best hand is a three-card "point": a flush. Add up the numeric
values of the cards (face cards counting as 10 and aces as 11) to find the
value of a point. (E.g., four-Jack-Ace of hearts: 4+10+11=25 points.)

  The lowest hand is a two-card "point" (e.g., ten of spades with Jack
and Ace of hearts: 10+11=21 points).

  Three cards matching none of these hands are worthless; there is no
equivalent of poker's "high card" in Commerce.


PLAYING THE CALCULATOR GAME

  First, the game will ask you for a number of opponents (from 2 to 4).
All the opponents use the same AI; taking on more opponents will make
each hand harder to win, since you'll be competing with more players for
the cards you want, and since the hands will be shorter.

  During the game itself, you'll see your three-card hand at the bottom
of the screen and the three-card widow at the top. The right half of the
screen is a text display that tells you what your opponents are doing
during their turns.

  A small box-shaped cursor will appear in the lower right corner of one
of your cards when it's your turn. Use the left and right arrows to move
the cursor to the card you want to exchange, and press 2nd. The cursor
will jump to the widow. Use the left and right arrows again to select the
card you want to exchange with, and press 2nd again. (Alternatively,
pressing Clear at this point will cancel the exchange and take you back
to your own hand.)

  Or, instead of exchanging a card, you can signal a knock by moving the
cursor onto to the "Knock" button on the far right of the display, and
pressing 2nd.

  After you've taken your turn, the computer opponents --- Ace, Pip, Tex,
and Val --- will take their turns, trading or knocking, as indicated in
the text display. When the display fills up, the game will pause (showing
the pause indicator in the upper right corner) to give you a chance to
read the messages before they're cleared away. Press Enter to unpause the
display.

  Once two players have knocked, the round is over. The text display will
show the hands of all the computer players, and then inform you of the
hand's winner. Press Enter to collect the cards and start the next hand.

  When it is your deal, you will be asked whether you'd like to exchange
hands with the widow. Pressing up-arrow will select the widow's hand (i.e.,
exchange), and pressing down-arrow or 2nd will select your own hand
(i.e., no exchange).


TECHNICAL DETAILS

  The external subroutine ZCMMV is used by the computer players to decide
which move to make. It's not the best decision-maker even based on the
information it gets --- and it certainly doesn't try to figure out whether
you might be collecting, say, clubs, based on your past moves this hand,
as a human player might. So it ought to be possible for the human player
to beat the computer quite often. Improvements to the AI are solicited,
but I've tried to strike a balance between competence and size. The current
AI is fairly small and fast, for all the work it does.

  The ZCRD and ZCMEVAL external subroutines are placed in the public domain;
improvements to the speed of ZCMEVAL will also be appreciated. If you find a
bug in ZCMEVAL (a hand reported incorrectly, or one hand reported as beating
another when in fact it should not), please let me know and I'll fix it. My
e-mail address can be found through ticalc.org.

Arthur O'Dwyer
August 2006
