.TH xmahjongg  "" "" "X Application"
.PC "Play solitaire mah-jongg"
.fi
\fBxmahjongg
[\-b \fInumber\^\fB]
[\-c]
.\"[\-d \fIhost\^\fB:\fIdisplay\^\fB]
[\-l \fIfile\^\fB]
.\"[\-n \fInumber\^\fB]
.\"[\-p \fIname\^\fB@\fImachine [... \fB-p \fIname\^\fB@\fImachine\fB]
[\-r]
[\-s]\fR
.PP
Mah-jongg is an ancient Chinese game, usually played by four players,
in which players manipulate tiles that resemble dominos.
.B xmahjongg
is an X Windows version for the solitaire game originally
seen on the PC and later ported to SunView.
With it, you can play against the computer.
.SH "Theory of Play"
The object of the game is to remove all the tiles from the board.
Tiles are removed in by matching two identical tiles which have either
an open left edge or open right edge.
The only exceptions to this rule are that any open
``flower'' tile (bamboo, orchid, plum, or chrysanthemum)
matches any other open ``flower'' tile, and that any open ``season'' tile
(spring, summer, autumn, or winter) matches any other open ``season'' tile.
.PP
The display has two distinct areas:
the playing field and the control field.
The playing field is the larger area in the lower part of the window.
To remove a pair of tiles, click any mouse
button on a tile, which then lights up; then click a mouse button on the
matching tile.
Both tiles then disappear from the board.
If  after selecting the first tile, you decide that you do not
wish to play it, simply reclick the button on the tile; the tile will
cease to be highlighted, and you can select another.
.PP
The control field is the upper area of the window.
The left side of this field displays the number of the board and the
number of tiles that remain in the playing field.
The right side of the control field holds buttons that you can click
to control play; they are as follows:
.IP \fK(SAME)\fR
Start the same game again.
This option is disabled in tournament mode.
.IP \fK(NEW)\fR
Start a new game.
.IP \fK(DONE)\fR
Check to see if you missed any matches.
When you think that that no matches remain,
click this button;
.B xmahjongg
will tell you the number of matches that you missed.
If you missed some, you can continue play, but your score will
not change.
The
.B DONE
field remains highlighted to show that you have already tried this option.
.IP \fK(QUIT)\fR
Exit the game.
.SH Options
.B xmahjongg
recognizes the following command-line options:
.IP "\fB\-b \fInumber\fR"
Begin the game with board
.IR number ,
which can range from one through 99,999.
.IP \fB\-c\fR
Set a tile's color on its type.
Normally, a tile's color indicates that the level the piece is on.
.\".IP \fB\-d\fR
.\"Use the given display name instead of the current default.
.IP \fB\-l\fR
Use a different layout file.
There are three layout files:
.IR default ,
.IR wedges ,
and
.IR bridge .
Normally,
.B xmahjongg
uses file
.IR default ,
which describes the standard layout in the shape of a pyramid.
The layout files are kept in directory
.BR /usr/games/lib/xmahjongg .
You can also use the option
.B \-s
to construct your own layout.
This option is described below.
.\".IP \fB\-n\fR
.\"Number of games to play in tournament mode.  See below.
.IP \fB\-r\fR
Reverse video mode:
indicate highlighting by reversing the foreground and background colors.
.IP \fB\-s\fR
Setup mode.
See below.
.\".IP \fB\-p\fR
.\"Set up a tournament with the specified player on the specified machine.
.\".SH "Tournament Mode"
.\"Using the [  \fI -p \fR ] parameter starts a tournament.  In this mode
.\"several players can compete on a series of boards.  The players should agree
.\"in advance on a starting board number.  The default tournament is three games,
.\"although this can be changed with the [ \fI -n \fR ] parameter.  If another
.\"player clicks "DONE" then, their score will be highlighted for that game.
.\"The tournament winner is the player with the lowest total score over the series.
.\".br
.\"   
.\".br
.\"Example:
.\".br
.\"Three users ('abc' on 'xyzzy', 'def' on 'plugh', and 'ghi' on 'plover') wish
.\"to play a 5 game tournament starting with board 12345.
.\"Here are their command lines:
.\".br
.\"   
.\".br
.\"      'abc' types:    xmahjongg -b 12345 -n 5 -p def@plugh -p ghi@plover
.\".br
.\"      'def' types:    xmahjongg -b 12345 -n 5 -p abc@xyzzy -p ghi@plover
.\".br
.\"      'ghi' types:    xmahjongg -b 12345 -n 5 -p def@plugh -p abc@xyzzy
.\".br
.\"   
.\".br
.\"Note that the players can be in any order on the command line and that the
.\"user does not list his/her own name on the command line.
.SH "Setup Mode"
Using the command-line
.B \-s
lets you configure your own layout.
If you use it with the option
.BR \-l ,
.B xmahjongg
writes the layout you construct into the file you name;
otherwise, it dumps the output to the standard output.
.PP
In setup mode, clicking the left-mouse button creates a tile position
where specified.
Clicking any other mouse button deletes the specified tile position.
Clicking the
.B DONE
button
dumps the layout; note, however, that it does so only if
no more tiles remain to be placed.
The
.B NEW
option clears the board to start designing a new layout.
The
.B SAME
option does not do anything.
.BR QUIT ,
as usual, quits.
.PP
The following example creates a layout called
.BR test ):
.DM
	xmahjongg -s -l test
.DE
.PP
This example plays the just-created layout:
.DM
	xmahjongg -l ./test
.DE
.SH "See Also"
.B
X applications
.SH Notes
.II "Young, Jeff S."
.II "Holm, Mark A."
.B xmahjongg
is copyright \(co 1990 by Jeff S. Young (jsy@cray.com).
The tiles themselves are copyright \(co 1988 by Mark A. Holm 
(tektronix!tessi!exc!markh).
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted, provided
that the above copyright notice appear in all copies, that both the above
copyright notice and this permission notice appear in supporting documentation,
and that the original copyright notices on the game boards are
displayed in their original format and clarity.
Permission to sell this
software is
.I not
granted without written permission from the author.
Permission to include this software free with other software packages in
.I not
granted without written permission from the author.
This distribution is publicly available, but is
.I not
in the public domain.
The author makes no representations about the suitability of this software
for any purpose.
It is provided ``as is'' without express or implied warranty.
.PP
Please note that on other operating systems,
.B xmahjongg
also has an option for playing a tournament across a network.
However, because \*(CO does not yet support networking,
this feature is not enabled under \*(CO.
