     Hearts consists of basically 3 parts:
1) The hearts distributor which keeps track of games in progress, and
   invokes new games (dealers) upon request.
2) The hearts dealer, which is the smarts of hearts, handling the actual
   deal, play, and computer strategy.
3) The hearts player, which is essentially an ignorant interface for each
   human player to the hearts dealer.  The dealer passes messages to the
   player about what to display, and the player has a curses implemented
   windowing interface for displaying those messages.  Messages include
   such information as what's in your hand, what's been played, the current
   score, etc.  Messages passed back to the dealer include what card to play,
   and messages to send to other players.


     The initial invocation of hearts forks off the distributor, which hangs
around till nobody needs it.  The distributor passes info to the select_game
portion of the hearts player showing games in progress, which are updated as
games progress.  The player may join any existing game, or start a new game,
at which point the distributor forks off a new dealer, complete with a good
socket port to listen for hearts players on.  The port # of the desired game
is passed back to the hearts player, which then connects to the dealer, and
play begins.

     Modifications to dump replace the cursed curses implementation should be
easy as all the code is inside hearts.c.  Perhaps if I ever get X windows
running on my workstation...

			Possible bugs and problems:

     If 2 people invoke hearts at the same time, it is possible that they will
both try to invoke the distributor.  The second one will fail, at which point
an error message will be printed.  I've considered a few methods of dealing
with this.  For one thing, once a player has connected to the dealer, the
distributor socket is closed.  When all dealers and players are gone, the
distributor exits.  Otherwise it is sitting in a select loop waiting for new
player connections, or status information from the dealers (hand and round
numbers, players joined or left).  Perhaps the distributor should hang around.
Maybe have it time out after, say, 30 minutes, then leave.  Or, the fix I'm
considering is having each hearts player do an exclusive lock on a file when
started.  When successful, the player will try to connect to the distributor.
If successful, fine, else the distributor is invoked, and when ready for
connections, then free the lock.  Thus is guaranteed no two players will try
to start the distributor.  Suggestions for how best to deal with this problem
are welcome!
     The strategy for the game came from an old Pascal program by Don Backus
of Oregon Software, with "improvements" by Jeff Hemmerling of Tessi.  I'm not
too sure the improvements help that much in that they do fix some bad play
problems, but at the same time make it a bit easier to shoot, and seem to
reduce the incidence of the computer accidentally shooting the moon.  There
at present is no algorithm for the computer to shoot, tho miraculously, it
on occasion succeeds!  I'm not to familiar with the rules of hearts, but I
see no rules regarding dumping hearts the first round or leading hearts when
not broken.  The latter causes a potential problem if hearts have not been
broken yet, and the leader has only hearts left.  If these rules are common,
or desirable, let me know as I'm considering tossing them from the new
strategy I'm writing.

     I've been too lazy to write a man page for it.  Maybe by next release...

	Bob Ankeney
	...!tektronix!reed!bob

----------------------------------------------------------------------

The X interfaces are named xmhearts (Motif) and xawhearts (Xaw).  The
Xaw variant is a quick translation of the Motif version to get
something running.  It doesn't behave as nicely with resizing, etc.

The great card bitmaps are from the Spider game, written by Heather
Rose (hrose@sun.com), Don Woods (woods@sun.com), and Dave Lemke
(lemke@ncd.com).  My discovery of these cards finally kicked me into
writing the X interfaces, after thinking about it for a few years.

I also modified the computer play strategy when I first picked up
hearts a few years ago.  I also made the Jack of Diamonds worth -10.
Presumably, you can not define MIKEYJ and have the old behavior, but I
haven't tested it.

	Mike Yang
	mikey@sgi.com
