-player player_file
This file informs the program of who the players are. It is an ascii file with the following form:
name1
display1
name2
display2
name3
display3
name4
display4
The name serves only to label the positions at the table. If the name begins with a colon, the computer plays that hand and the display is ignored (but still required). Names must not have any white space. A human name must be first. The application's resources will be read from the .Xdefaults file of the first player.
For example, to play a game against me and two computer opponents:
YourName
YourDisplay
:computer
ignored
Gene_Dykes
128.84.247.86:3
:computer
ignored
-goal points
The game ends whenever any player reaches this level. The winner is the person with the lowest number of points. The default is 100 points.
-jack
With this flag specified, the jack of diamonds is worth -10 points. The computer as an opponent has no strategy for dealing with it. The default is that the jack of diamonds is not special.
-pass style
There are four possibilities for determining where to pass three cards:
"leftright"
"leftrightacross"
"leftrightacrosskeep"
"leftrightkeep"
The default is Left_Right_Across.
As with other Xcu resources, spaces, underscores, and Capitalization may be arbitrarily part of the above strings.
-drop
When this flag is specified, points may be sloughed to the first trick. The default is that hearts and the queen of spades may not be played on the first trick.
-wlm wlm_file
The compiled layout description file may be specified with this flag. The default is to look for a file called "hearts.wc".
-seed integer
This option seeds the random number generator, thus allowing the exact game to be played again.
-sleep seconds
This option specifies how many seconds the computer should wait before allowing a player to play to the next trick. The default is two.
-log file
This option tells the computer where to save a log file of its strategy decisions. This allows the author to figure out why the computer occasionally plays with a bit of brain damage.
The program may need to be told where to find the bitmaps by setting the "bitmapFilePath" resource properly. You may want to install the four files (club.h, diamond.h, heart.h, spade.h) where they will be easy to find.
The following are resources introduced by the program.
xhearts resources | |||
Name | Type | Default | Description |
XtNgoal | Int | 100 | Game Limit |
XtNpassingStyle | PassingStyle | LeftRightAcross | 3-card passing rotation |
XtNdropOnFirst | Boolean | False | Points on first trick allowed |
XtNjackCounts | Boolean | False | Jack counts as minus ten points |
XtNplayerFile | String | "players" | The players file |
XtNlogFile | String | "/dev/null" | The strategy log file |
XtNwlm | String | "hearts" | The compiled layout file |
XtNseed | String | NULL | The random number generator seed |
XtNsleep | Int | 2 | The required wait between tricks |
These four resources allow configuring the game to popular variations:
goal When any player reaches this score the game is over
jackCounts Whether the jack of diamonds counts minus 10
dropOnFirst Whether or not points are allowed to be dropped on first trick
passingStyle The discard passing direction cycle
These four resources control some of the game mechanics:
playerFile The name and $DISPLAY for each player
wlm The name of the compiled wlm file
seed The seed for initializing the random number generator
sleep Number of seconds that must be allowed to elapse before
leading to next trick
xhearts*font :
This will be the font used for the cards, and maybe some others. The fonts of other things are hardcoded into the .wl files, where they can be changed and recompiled if desired. I can't figure out how to change the fonts of a select kind of widgets without specifying a path for each and every group of them... (Suppose you have label widgets scattered throughout the interface, and you want 10 of them to be green -- there doesn't seem to be any way to set the resource for them without specifying a resource for each individual widget.)
How to play this version of hearts really needs no explanation -- just point and click as appropriate. You can change your mind on discards, but "a card laid is a card played!"
I should have a quick summary of hearts rules here. Sorry!
I know of several dumb plays the computer occasionally makes, and I should have fixes for them soon, but in general the computer plays well, and so far as I know, always legally. It never tries to shoot the moon, but it does a fair job of moon prevention.
It would be nice to expand this thing so we could hold hearts tournaments! If anybody would like to take a stab at writing a strategy to compete against mine, I could also make that easier to do.