home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / x / xhearts.zip / NOTES < prev    next >
Text File  |  1992-01-07  |  4KB  |  81 lines

  1.      Hearts consists of basically 3 parts:
  2. 1) The hearts distributor which keeps track of games in progress, and
  3.    invokes new games (dealers) upon request.
  4. 2) The hearts dealer, which is the smarts of hearts, handling the actual
  5.    deal, play, and computer strategy.
  6. 3) The hearts player, which is essentially an ignorant interface for each
  7.    human player to the hearts dealer.  The dealer passes messages to the
  8.    player about what to display, and the player has a curses implemented
  9.    windowing interface for displaying those messages.  Messages include
  10.    such information as what's in your hand, what's been played, the current
  11.    score, etc.  Messages passed back to the dealer include what card to play,
  12.    and messages to send to other players.
  13.  
  14.  
  15.      The initial invocation of hearts forks off the distributor, which hangs
  16. around till nobody needs it.  The distributor passes info to the select_game
  17. portion of the hearts player showing games in progress, which are updated as
  18. games progress.  The player may join any existing game, or start a new game,
  19. at which point the distributor forks off a new dealer, complete with a good
  20. socket port to listen for hearts players on.  The port # of the desired game
  21. is passed back to the hearts player, which then connects to the dealer, and
  22. play begins.
  23.  
  24.      Modifications to dump replace the cursed curses implementation should be
  25. easy as all the code is inside hearts.c.  Perhaps if I ever get X windows
  26. running on my workstation...
  27.  
  28.             Possible bugs and problems:
  29.  
  30.      If 2 people invoke hearts at the same time, it is possible that they will
  31. both try to invoke the distributor.  The second one will fail, at which point
  32. an error message will be printed.  I've considered a few methods of dealing
  33. with this.  For one thing, once a player has connected to the dealer, the
  34. distributor socket is closed.  When all dealers and players are gone, the
  35. distributor exits.  Otherwise it is sitting in a select loop waiting for new
  36. player connections, or status information from the dealers (hand and round
  37. numbers, players joined or left).  Perhaps the distributor should hang around.
  38. Maybe have it time out after, say, 30 minutes, then leave.  Or, the fix I'm
  39. considering is having each hearts player do an exclusive lock on a file when
  40. started.  When successful, the player will try to connect to the distributor.
  41. If successful, fine, else the distributor is invoked, and when ready for
  42. connections, then free the lock.  Thus is guaranteed no two players will try
  43. to start the distributor.  Suggestions for how best to deal with this problem
  44. are welcome!
  45.      The strategy for the game came from an old Pascal program by Don Backus
  46. of Oregon Software, with "improvements" by Jeff Hemmerling of Tessi.  I'm not
  47. too sure the improvements help that much in that they do fix some bad play
  48. problems, but at the same time make it a bit easier to shoot, and seem to
  49. reduce the incidence of the computer accidentally shooting the moon.  There
  50. at present is no algorithm for the computer to shoot, tho miraculously, it
  51. on occasion succeeds!  I'm not to familiar with the rules of hearts, but I
  52. see no rules regarding dumping hearts the first round or leading hearts when
  53. not broken.  The latter causes a potential problem if hearts have not been
  54. broken yet, and the leader has only hearts left.  If these rules are common,
  55. or desirable, let me know as I'm considering tossing them from the new
  56. strategy I'm writing.
  57.  
  58.      I've been too lazy to write a man page for it.  Maybe by next release...
  59.  
  60.     Bob Ankeney
  61.     ...!tektronix!reed!bob
  62.  
  63. ----------------------------------------------------------------------
  64.  
  65. The X interfaces are named xmhearts (Motif) and xawhearts (Xaw).  The
  66. Xaw variant is a quick translation of the Motif version to get
  67. something running.  It doesn't behave as nicely with resizing, etc.
  68.  
  69. The great card bitmaps are from the Spider game, written by Heather
  70. Rose (hrose@sun.com), Don Woods (woods@sun.com), and Dave Lemke
  71. (lemke@ncd.com).  My discovery of these cards finally kicked me into
  72. writing the X interfaces, after thinking about it for a few years.
  73.  
  74. I also modified the computer play strategy when I first picked up
  75. hearts a few years ago.  I also made the Jack of Diamonds worth -10.
  76. Presumably, you can not define MIKEYJ and have the old behavior, but I
  77. haven't tested it.
  78.  
  79.     Mike Yang
  80.     mikey@sgi.com
  81.