Release 1.07                                            Aug. 18, 1990

CRIB-VGA is the classic two-handed game of cribbage.

It requires and IBM compatible PC with a VGA graphics adapter and a
color monitor with at least 512K memory.

It supports an IBM or Microsoft mouse if available (it tries to load
MOUSE.COM during initialization).

The Microsoft QuickBASIC 4.00 source code is also included, as this
is a "FreeWare" program which I release into the public domain.

The following files should be included in the CRIB-107.ZIP archive.

  CRIB.BAS       QuickBASIC source code for the main routine
  DISPLAY.BAS    QuickBASIC source code for the card display overlay
  INITIALZ.BAS   QuickBASIC source code for the crib board overlay
  COMPILE.BAT    Batch file to compile for DOS based machines
  CRIB-VGA.EXE   the only file needed to actually play the game
  MOUSE.LIB      QuickBASIC Library for mouse support
  CRIB.LIB       QuickBASIC Library for the overlay files
  CRIB.TXT       This documentation file

This is release 1.07 of the program, originally written almost two
years ago. It corrects some minor deficiencies in the counting/scoring
algorithms and expands the hint facility for both discarding to
the crib hand as well as play during the meld.

If you improve my code, I would really appreciate a copy of the changes
you make. Enjoy.

       Don Hanson
       7362 Brandywine Place
       Vancouver, B.C.  V5S 3Z7
       Canada
       (604) 433-4536


CRIBBAGE

The classic two-hand card game.

Cribbage is a strategy game for two players.

It is believed to have been invented and christened by the English
poet Sir John Suckling, who lived 1609-1642.  Some of its features
were taken from an older game, Noddy, of which little is known. Early
colonists brought Cribbage to America, where it flourishes. In New
England there are clubs devoted to Cribbage, conducting intra- and
intercity tournaments.

PLAYERS: Two.

CARDS: A regular pack of 52.  The cards rank: K (high), Q, J, 10, 9,
8, 7, 6, 5, 4, 3, 2, A. The suits play little part; the cards are used
chiefly as numbers.  Each face card represents 10, each ace 1, each
other card its index value. Face cards and tens are called tenth
cards.

First the cards are shuffled and randomly cut, and each opponent is
dealt a card face up. The lowest card gets the privilege of getting
the first crib hand. Note, the Duce (2) is low and the Ace (1)
considered high.

THE DEAL:

Next, the cards are again shuffled and each player is dealt 6 cards,
one at a time. The turn to deal alternates each hand. Each player must
decide which 4 cards to retain and which 2 cards to discard to the
CRIB (or extra) hand.

This is where a large part of the strategy comes into play.

Position the pointer over the first card you wish to discard and click
the left mouse button once. Then position the pointer over the second
card to discard, and again click the left mouse button once.

Keyboard users select the cards to discard by pressing the numbers 1
to 6, as are shown underneath each playing card (mouse users may also
press a number key).

Be careful.. Once you have selected a discard you may not change your
mind. Hence the phrase:

       A CARD LAID IS A CARD PLAYED

THE CRIB:

The two cards that each play discards are placed face down near the
dealer. They form the crib, an extra hand that belongs to the dealer.

THE STARTER:

After the crib is laid away, the rest of the pack is cut and the top
card of the lower portion is turned up.

This card is the starter. If it is a jack the dealer pegs (scores) 2
points.

THE CRIBBAGE BOARD:

Scores accrue so rapidly that a special scoring device is used, a
cribbage board. As shown on the right, the board is an S-shaped panel
having two rows of 120 holes each, plus some extra game holes at one
end. Each player uses two pegs, which at the outset are placed in the
end starter holes. The last hole (the 121st) is the final game hole.
The first player to reach it wins the game.

Each item of score is marked by jumping the rearward peg ahead of the
other by a corresponding number of holes.

In this electronic version, the score is maintained by the computer.
The red line of holes is for you, the blue line of holes is used by
your computer opponent.

THE PLAY:

The nondealer begins by playing any card, announcing its point value,
as "Ten" if he leads a face card or ten.  This is called the meld
count, and is shown on the screen numerically (as the computer cannot
vocalize the count).

The dealer then plays a card, announcing the total of the two cards,
as "Seventeen" if he plays a seven.

Play continues alternately, the new total being announced (or
displayed) each time, until the player in turn is unable to play
without carrying the total over thirty-one.

He must then GO. (Explained in more detail next)
If you cannot play without exceeding the meld count of thirty-one (31)
then you must position the pointer over the word GO and click the left
mouse button once.

Keyboard users press the letter G, to indicate a GO.

After a go is called, the other must play additional cards if he can
do so without exceeding thirty-one. Thus the same player may play two
or three times in succession.

For making EXACTLY thirty-one the player pegs 2 for a go at less than
thirty-one he pegs 1.

Playing the last card of all (of the eight in play) counts 1 for LAST
CARD, or 2 if it makes exactly thirty-one.

SCORING IN PLAY:

Other points may be scored in play besides the go's.

The program will count them for you in this computer version of
cribbage, and they are as follows:

FIFTEEN. For making the meld count fifteen, peg 2.

PAIRS.  For playing a card of the same rank as that just played by an
opponent, peg 2.  (Pairing goes by rank, e.g., a King with a King, not
with a Queen, though both have the point value of 10.)  For playing
the third card of a rank peg 6, and for playing the fourth (or
four-of-a-kind) peg 12.

RUNS.  For playing a card that is in sequence of rank with two or
more played just previously, peg the number of cards in the run
(sequence).  For example, if the cards played are 4, 6, 5, the last
player pegs 3 for the run PLUS 2 for fifteen.  The cards need not be
played in sequential order to score for run, so long as no foreign
cards intervene.  For example, if the cards played are 4, K, 6, 5
there is no run.

SHOWING:

Showing means counting and scoring a hand. The hands are shown in
strict order: Nondealer, Dealer's hand & Crib.

The starter is treated as a fifth card belonging to each of the three
hands (Nondealer, Dealer and Crib).

Combinations that score are as follows:

FIFTEEN. For each combination of cards that total fifteen, score 2.
Combination here is meant in the strict sense.  Thus, a hand (with
starter) of 9, 8, 7, 7, 6 has three combinations of fifteen:  9 and 6,
8 with one 7, 8 with the other 7.  A hand of J, 5, 5, 5, 5 has no less
than eight combinations of fifteen:  four of J and 5, and four of
three 5's.

This hand, when the Jack also scores as his nobs, makes 29, the
largest possible score.

PAIRS. For a pair, score 2 for three of a kind score 6 for four of a
kind (double pair royal) score 12.

RUNS. For each combination that makes a run of three or more, peg the
number of cards in the run.  In the hand 9, 8, 7, 7, 6 there are 8
points for two runs of four, using the seven's in turn.

FLUSH.  For four cards in hand (not crib, and excluding the starter)
of the same suit, score 4 or 5 if the starter is also of the same
suit.  For crib and starter all of the same suit, score 5.  (There is
no score for a four-flush in the crib.)

HIS NOBS. For a Jack in hand, of the same suit as the starter, score
one point.  The Jack scored as starter by the dealer is called HIS
HEELS.

NINETEEN. Since no combination of cards will score exactly nineteen,
this is a term sometimes used in place of * no score *, when
counting.

The program will count the hands, as explained next.

During the scoring of the hands, each combination that results in a
score (Fifteens, Pairs, Runs, Flush and His Nobs) are shown, along
with the accumulated total for that hand.

Press the left mouse button (or any key on the keyboard) to continue
the count. This gives you a chance to practice counting along with the
computer, just to keep it honest.

GAME.

When a player pegs into the game hole that gives him 121 points, he
wins the game forthwith -- nothing more is scored. If the loser has
not reached the halfway mark (61 points) he is SKUNKED or lurched and
considered to lose a double game. The Skunk line is marked with the
letter S on the cribbage board.

STRATEGY OF CRIBBAGE:

The choice of cards to give the crib is often easy. Count all the
points in the six cards, then lay away the two picked to leave the
maximum possible score in the remaining four. But sometimes this
course would put points or valuable cards in the crib, so that if the
crib is not yours you may do better to deplete your hand somewhat in
order to BALK the crib.

Dangerous cards to put in the adverse crib are fives, sevens and
eights and NEAR cards -- two in sequence or in sequence-but-one. The
best balking cards are very high, very low, and wide cards generally
-- separated in rank by two or more.

Sometimes you are forced to split combinations, even when the crib is
yours. As a rule, keep a run of three or more, splitting a pair
instead, if necessary. Holding a run gives you maximum chance of
increasing your count by help of the starter.

I have included a Hint facility to help novices learn what cards the
computer would discard, had it been dealt the same hand. Please note,
the computer plays VERY conservatively and does not weigh all the
options of chance. You may see an even better choice than it's HINT.

Once play has begun, the hint will suggest the best valid card to
play. However, the human brain is far better at examining all the
myriad of possible play combinations, and you will most often disagree
with what the computer suggests.

The save game facility creates a file called CRIB.SAV.  This is
intended for a future release that will allow a restore of a
previously saved game.
The Quit option exits the game immediately, as will the Esc (Escape)
key at any time keyboard/mouse input is expected.

For those who are interested, this program was completely written and
compiled with Microsoft QuickBASIC version 4.00. Source code and a
compiler batch file are included for the technically oriented.

It was produced on an IBM PS/2 Model 30-286 with 1 Meg.  of memory and
a 40 Meg fixed disk. A Microsoft mouse was the pointing device, and an
IBM 8513 VGA color monitor was the video display.

Many friends at Westech Information Systems tried it out on quite a
variety of equipment combinations, and offered valuable feedback and
beta-testing.

In the interest of promoting free public domain software I sincerely
hope that no one commercially benefits from my efforts. I make no
copyright or claim other than to hope you enjoy it.

     NOW, ON TO PLAYING THE GAME...
