Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!lll-lcc!mordor!sri-spam!sri-unix!hplabs!pesnta!amd!intelca!mipos3!omepd!psu-cs!reed!tektronix!uw-beaver!fluke!toma
From: toma@tc.fluke.COM (Tom Anderson)
Newsgroups: net.sources.games
Subject: network chess (2 of 5)
Message-ID: <257@spock.tc.fluke.COM>
Date: Thu, 8-Jan-87 18:49:28 EST
Article-I.D.: spock.257
Posted: Thu Jan  8 18:49:28 1987
Date-Received: Thu, 15-Jan-87 19:07:21 EST
Organization: John Fluke Mfg. Co., Inc., Everett, WA
Lines: 1625


# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by spock!toma on Thu Jan  8 15:37:19 PST 1987
# Contents:  Icons/ Makefile nchess.6 decls.h nchess.h daemon.c xdr.c
#	Icons/bishop.icon Icons/bishopStencil.icon Icons/king.icon
#	Icons/kingStencil.icon Icons/knight.icon Icons/knightStencil.icon
#	Icons/pawn.icon Icons/pawnStencil.icon Icons/queen.icon
#	Icons/queenStencil.icon Icons/rook.icon Icons/rookStencil.icon
#	Icons/blackSquare.icon Icons/whiteSquare.icon Icons/nchess.icon
 
echo x - Makefile
sed 's/^@//' > "Makefile" <<'@//E*O*F Makefile//'
#
# Makefile for nchess package.
#

ALLOBJS = board.o boardsw.o main.o ipc.o controlsw.o daemon.o \
	tool.o xdr.o msgsw.o talksw.o 
CLIENTOBJS = board.o main.o ipc.o xdr.o tool.o controlsw.o boardsw.o \
	msgsw.o talksw.o chessprocess.o
SERVEROBJS = daemon.o xdr.o

CLIENTSRCS1 = board.c main.c 
CLIENTSRCS2 = ipc.c tool.c controlsw.c 
CLIENTSRCS3 = boardsw.c msgsw.c talksw.c chessprocess.c
CLIENTSRCS4 = xdr.c
CLIENTSRCS = $(CLIENTSRCS1) $(CLIENTSRCS2) $(CLIENTSRCS3) $(CLIENTSRCS4)

SERVERSRCS = daemon.c xdr.c

HEADERS = decls.h nchess.h

ICONS = Icons/bishop.icon Icons/bishopStencil.icon \
	Icons/king.icon Icons/kingStencil.icon \
	Icons/knight.icon Icons/knightStencil.icon \
	Icons/pawn.icon Icons/pawnStencil.icon \
	Icons/queen.icon Icons/queenStencil.icon \
	Icons/rook.icon Icons/rookStencil.icon \
	Icons/blackSquare.icon Icons/whiteSquare.icon \
	Icons/nchess.icon

# CFLAGS = -g
CFLAGS = -O

all : nchessd nchess

nchessd : $(SERVEROBJS)
	cc $(CFLAGS) -o nchessd $(SERVEROBJS)

nchess : $(CLIENTOBJS)
	cc $(CFLAGS) -o nchess $(CLIENTOBJS) -lsuntool -lsunwindow -lpixrect

shar : $(SERVERSRCS) $(CLIENTSRCS) $(HEADERS) $(ICONS)
	shar -c Makefile nchess.6 $(HEADERS) $(SERVERSRCS) Icons $(ICONS) > shar.1
	shar -c $(CLIENTSRCS1) > shar.2
	shar -c $(CLIENTSRCS2) > shar.3
	shar -c $(CLIENTSRCS3) > shar.4

lint : $(SERVERSRCS) $(CLIENTSRCS)
	lint $(SERVERSRCS)
	lint $(CLIENTSRCS)

list : $(SERVERSRCS) $(CLIENTSRCS) $(HEADERS)
	lpr -x2 -p -J"nchess" *.h *.c

clean : 
	rm -f *.o nchess nchessd

$(ALLOBJS) : $(HEADERS)

@//E*O*F Makefile//
chmod u=rw,g=r,o=r Makefile
 
echo x - nchess.6
sed 's/^@//' > "nchess.6" <<'@//E*O*F nchess.6//'
@.TH NCHESS 6 "14 October 1986"
@.SH NAME
nchess \- general-purpose chess tool
@.SH SYNOPSIS
@.B nchess
[\fB-c\fP]
@.br
	[\fB-e\fP | \fB-r\fP\fIrestoreFileName\fP]
@.br
	[\fB-s\fP\fIsaveFileName\fP]
@.br
	[\fB-d\fP\fIpieceIconDirectory\fP]
@.br
	[\fB-t\fP\fItranscriptFileName\fP]
@.br
	[\fB-x\fP\fIn\fP]
@.br

	\fB-m\fP\fIchessProgram\fP [\fB-m\fP\fIarg\fP ...] | \fB-n\fP\fIchessProgram\fP [\fB-n\fP\fIarg\fP ...]
@.br
	or
@.br
	\fB-m\fP\fIchessProgram\fP [\fB-m\fP\fIarg\fP ...] \fB-n\fP\fIchessProgram\fP [\fB-n\fP\fIarg\fP ...]
@.br	
	or
@.br
	[\fB-b | -w\fP] \fIuser@host\fP
@.SH DESCRIPTION
@.I Nchess
is a general-purpose chess interface suitable for playing any 
combination of { human, machine } vs. { human, machine }.
Some of the more notable features of nchess 
are facilities for generating transcript files
in various formats,
for saving and restoring games,
and for setting up initial board situations.
@.SH "INVOCATION"
@.LP
Nchess accepts numerous command line arguments:
@.IP "\fB-c\fP"
don't keep an internal copy of the board's display image
(the default is to keep one)
@.IP "\fB-b\fP"
ask to play the black pieces
@.IP "\fB-w\fP"
ask to play the white pieces
@.IP "\fB-e\fI"
edit the board (i.e., set up a non-standard board configuration)
prior to starting the game
@.IP "\fB-r\fP \fIrestoreFileName\fP"
resume a game from the game saved in \fIrestoreFileName\fP
@.IP "\fB-s\fP \fIsaveFileName\fP"
use \fIsaveFileName\fP for saving games instead of the 
default \fB"nchess.save"\fP.
@.IP "\fB-t\fP \fItranscriptFileName\fP"
use \fItranscriptFileName\fP for writing transcripts instead of the 
default \fB"nchess.transcript"\fP.
@.IP "\fB-x\fP\fIn\fP"
generate transcripts in format \fIn\fP, where \fIn\fP is one of:
@.nf

		0	formal; e.g., P/K2-K4, R/KB3xP
		1	minimal; e.g., P-K4, RxP (the default)
		2	algebraic; e.g., E2E4, F3F5
@.fi
@.IP "\fB-d\fP \fIpieceIconDirectory\fP"
look in \fIpieceIconDirectory\fP for piece icons to use instead
of the default ones supplied by \fInchess\fP.
@.IP "\fB-m\fP \fIchessProgram\fP"
start up \fIchessProgram\fP playing the white pieces
@.IP "\fB-n\fP \fIchessProgram\fP"
start up \fIchessProgram\fP playing the black pieces
@.LP
Specifying \fB-c\fP forces \fInchess\fP to recompute the board
image whenever any portion of it must be made visible again.
However, the memory savings it entails may justify its use 
for systems which are running a bit short.
@.LP
The \fB-m\fP and \fB-n\fP arguments are cumulative.
The first of either is interpreted as the name of an 
executable chess program;
subsequent instances are collected and passed as arguments 
to the chess program.
@.SH "HUMAN VS. HUMAN"
@.LP
Human vs. human games are started by
invoking \fInchess\fP with an argument of
the form "\fIuser@host\fP" and
neither of the \fB-m\fP, \fB-n\fP arguments.
Both the local machine and the host specified by the \fIhost\fP
argument must be running \fInchessd(6)\fP (hereafter referred
to as the daemon).
\fINchess\fP first checks the local daemon for an invitation 
registered by \fIuser\fP at \fIhost\fP.
If none is found, \fInchess\fP sends an invitation to the 
daemon running on \fIhost\fP,
prints something like "Waiting for \fIuser\fP to respond...",
then idles waiting for a message from a 
responding \fInchess\fP process.
In turn, the remote daemon prints something useful 
and sufficiently distracting on the remote console.
@.LP
If an invitation was found waiting in the local daemon,
\fInchess\fP sends a response message to the 
peer \fInchess\fP process.
Subsequent communication is peer-to-peer; 
i.e., the daemon is no longer consulted for anything.
If either user specified \fB-b\fP or \fB-w\fP,
the two peers attempt to satisfy color preferences;
if both users requested the same color,
a single round of arbitration results.
If this arbitration fails, 
both \fInchess\fP processes exit, 
awaiting a less contentious session.
@.SH "HUMAN VS. MACHINE"
@.LP
Human vs. machine games are started by 
invoking \fInchess\fP with one of 
the \fI-m\fP or \fI-n\fP arguments.
The existence of the daemon is not required.
The chess program used is expected to conform to 
the interface protocol described below.
@.SH "MACHINE VS. MACHINE"
@.LP
Machine vs. machine games are started by 
invoking \fInchess\fP with both of 
the \fI-m\fP and \fI-n\fP arguments.
The existence of the daemon is not required.
Both chess programs used are expected to conform to 
the interface protocol described below.
@.SH "MESSAGE SUBWINDOW"
@.LP
During the course of the game, 
various messages appear in a one-line subwindow
directly over the button panel.
These messages may direct you to press certain buttons
to confirm various actions (e.g., resigning, allowing an undo).
The cursor must be positioned in the board subwindow
when buttons are pressed in response to a message.
@.SH "NORMAL PLAY"
@.LP
In normal play, pieces are moved by positioning the cursor
over the square a piece resides on,
depressing the left mouse button,
moving the piece to the desired square,
and releasing the button.
After moving, activity in the board subwindow is 
suppressed until a move is made by the opponent.
@.LP
Certain move types deserve special mention.
En passant pawn captures are performed by moving the 
capturing pawn to the third rank square;
i.e., the square it will reside on after the move.
\fINchess\fP enforces the restriction that en passant
capturing rights expire after the move immediately 
following the pawn advance.
Castling to either side is performed by moving the
king two squares in the appropriate direction.
Finally, pawn "queening" is a three-step process:
First, the pawn is moved to the eighth rank, where
it is initially polymorphed to a queen.
Second, the pawn is rotated through the set of legal
pawn morphs for every left mouse button click (the legal
pawn morphs are queen, bishop, knight, and rook).
Finally, the move is sent to the opponent when the middle 
button is pressed.
(Note: If the opponent is a machine,
pawns may only be promoted to queens
and step two is skipped.)
@.LP
At any time during the game,
clicking the left mouse button on one of
several buttons above the board subwindow 
will have the following effects:
@.IP "(Resign)"
Resignation is final; and after confirming
that you really wanted to resign,
it's curtains...
@.IP "(Undo)"
Against a human opponent, this button causes \fInchess\fP
to forward a request to your opponent to undo your last move.
Assuming your opponent agrees, your last move will no longer
haunt you and it will be your turn again.
If it was your turn to play, 
your opponent's last move will be undone as well.
Against a machine opponent, 
acquiescence is implicit.
Undos can be repeated,
constrained only by reaching the initial game state and
the limits of your opponent's compassion.
@.IP "(Last Play)"
The last play made by either side will be illustrated by
briefly undoing the move in the board subwindow.
@.IP "(Transcript)"
A transcript of the game is written to the transcript file
specified on the command line; if no file was specified,
"nchess.transcript" is used.
@.IP "(Save)"
The game state (including the move history) is saved in the
file specified on the command line; if no file was specified,
"nchess.save" is used.
@.LP
When both players are machines, the "Resign" and "Undo"
buttons are omitted from the window.
@.SH "EDITING THE BOARD"
@.LP
When \fInchess\fP is invoked with the \fB-e\fP flag,
the tool starts up as a board editor with initial play suspended.
Pieces are deleted by positioning the cursor over the 
square the piece resides on and clicking the middle button.
Pieces are created by positioning the mouse over the square
a piece of the desired type and color would reside on at the 
beginning of a normal game, 
depressing the left button, 
moving the piece to the destination square,
and releasing the button.
When editing is complete and play is about to commence, 
the right button is clicked,
followed by another mouse click
to confirm exiting the board editor (once the board editor is
exited, it cannot be re-entered).
If this is a human vs. human game, the user is then asked
to specify which side moves first (via yet another mouse click).
Following that, the game is afoot.
@.LP
Boards can be edited for any of the { human, machine } combinations
described above.
After setting up a board for a machine vs. machine session, 
the human is reduced to being a mere spectator.
Also, in any combination involving machines the white pieces
always move first, due to a deficiency in the existing 
Unix chess program.
@.SH "BADGERING YOUR OPPONENT"
@.LP
\fINchess\fP provides a one-line talk subwindow in human vs. human
games for sending pithy messages to your opponent.
To send a message, position the cursor to the right of the "\fBSend:\fP"
field, type the message, and hit carriage return.
The message will not be sent until you've typed the carriage return,
allowing you to use the normal Unix line editing features.
@.SH "CREATING YOUR OWN PIECES"
@.LP 
\fINchess\fP allows you to supplant any or all of the pictorial piece 
representations (icons) with pieces of your own design.
A few guidelines concerning icon creation are outlined below.
For starters, you might want to take a look at the 
icons used by \fInchess\fP.
@.LP
All icons used by \fInchess\fP are drawn using \fIicontool(1)\fP,
and are (\fIicontool\fP's default) 64 pixels wide, 64 pixels high,
and 1 pixel deep.
Only the black pieces are drawn - the white pieces are created
by \fInchess\fP by inverting the black pieces.
You must leave a blank border of at 
least three pixels around the piece,
and the piece should be centered in \fIicontool's\fP drawing subwindow.
@.LP
After you have drawn the piece, you need to create the 
corresponding "stencil" image.
The stencil is used by \fInchess\fP to limit drawing the piece on
the board to only those areas within the 64 by 64 square that
actually represent the piece image.
Also, in order to create the white pieces correctly, the stencil
border needs to be grown one pixel past the piece image border - this
gives the white piece a thin black line border.
An easy way to create the stencil is to use the
following procedure:
@.IP
Load the piece image
@.IP
Select "Fill: black" and "Fill: xor" modes.
@.IP
Fill the entire drawing subwindow.  You should now have a reverse
video image of the piece.
@.IP
Select "Fill: white" and "Fill: src" modes, and get rid of all 
black pixels except for a one-line border 
around the white piece image.
@.IP
Select "Fill: black" mode and fill inside the border.
@.LP
You should now have a solid black image of the piece which is one
pixel bigger in all directions than the image you drew earlier.  
Store this image as the stencil.
If you want any parts of the piece to be transparent 
(e.g., windows in the rook),
simply leave those parts white in the stencil.
@.LP
The file names to use for the various pieces and stencils are listed
below in the "FILES" section.
Both the piece and stencil images must be accessible in the 
specified icon directory before \fInchess\fP will attempt to use them.
@.LP
In case you are concerned,
using your own pieces does not cause \fInchess\fP to use any more
memory than it already does.
@.SH "CHESS PROGRAM INTERFACE PROTOCOL"
@.LP
The protocol for communication with chess programs is derived
in bottom-up fashion from the syntax and semantics
used by the existing Unix chess program.
When the program starts up, 
it is expected to make a short one-line announcement (e.g., "Chess"),
which \fInchess\fP simply throws away.
Next, \fInchess\fP sends a single line consisting of the keyword "alg",
which informs the chess program that algebraic notation is desired.
@.LP
If \fInchess\fP was invoked with the \fB-e\fP flag,
the next communication with the chess program is to deliver the 
setup information.
This is done by sending a single line consisting 
of the keyword "setup",
followed by eight lines of eight characters each.
Each character represents the piece on a square, 
with space characters representing empty squares.
For the white pieces, 
the characters used are { p, n, b, r, q, k } for 
pawn, knight, bishop, rook, queen, and king, respectively.
Black pieces are represented by the upper case equivalent.
Lines are transmitted starting with the eighth rank (i.e., a8-h8).
After receiving the eighth setup line (a1-h1),
the chess program is expected to respond with a single line 
consisting of either the key 
phrase "Setup successful" or "Illegal setup".
@.LP
Next, the chess program will be sent either the first move by
its opponent (which will be white), 
or a single line consisting of the keyword "first",
which it should interpret to mean that it should play the white pieces
and that it should make the first move.
Moves sent to the chess program will always be in the format
implied by the printf string "%c%d%c%d\\n",
where the character specifications describe the file [a-h]
and the decimal digit specifications describe the rank [1-8].
En passant captures are encoded as a horizontal move; e.g., d5e5.
Castling moves are encoded as the king move; e.g., e1g1.
Pawns implicitly turn into queens; thus, d7d8 implies P-Q8(Q).
@.LP
After receiving a move, the chess program must echo a single line.
The standard Unix chess program uses this line to re-format and 
echo the move it received; 
however, \fInchess\fP does not interpret the echo and thus 
places no restrictions on its format.

@.SH "FILES"
@.br
bishop.icon
@.br
bishopStencil.icon
@.br
king.icon
@.br
kingStencil.icon
@.br
knight.icon
@.br
knightStencil.icon
@.br
pawn.icon
@.br
pawnStencil.icon
@.br
queen.icon
@.br
queenStencil.icon
@.br
rook.icon
@.br
rookStencil.icon
@.br
@.SH "SEE ALSO"
chess(6), chesstool(6), nchessd(6)
@.SH "BUGS"
@.LP
There aren't any clocks (yet).
@.LP
The board editor cannot be re-entered.  This is intentional, in order
to keep the middle of the game orderly.  However, some of the author's
cohorts think it is a bad idea.
@.LP
Transcript files do not show the initial board state, which makes
it necessary to separately document non-standard initial positions.
This will be corrected in a future release.
@.LP
The algebraic notation used for transcripts is not really what you
might expect.
@.LP
When either player is a machine, pawns may be promoted only to queens.
This bug is inherited from the existing Unix chess program.
@.LP
When either player is a machine, the white pieces must always make 
the first move in a game.
This is another bug inherited from the existing Unix chess program.
@.LP
Saved games must be re-started with the same configuration of human
and machine players.
This bug is due to the unknown format of the existing Unix chess
program's save files and to the lack of any known standard for 
the format of such files.
@.LP
The talk subwindow has no facility for queueing lines for paced
review by the receiver (as in games like rogue and hack).
Also, there is no way to shut the door if the opponent's messages
are a source of irritation instead of amusement or enlightenment.
@.LP
The rules for offering, accepting, and detecting draws are not
implemented.  These apparently have ramifications with regard to 
handling clocks, and are the principal reason clocks are not 
implemented yet.  All this will be implemented in a future release.
For now, the talk subwindow is expected to suffice.
@.LP
Checkmate and stalemate are not explicitly detected 
by \fInchess\fP, since it doesn't have an internal 
legal move generator.
Again, the talk subwindow is expected to suffice.
@.LP
There is currently no way to play Blitz chess rules (e.g., don't 
announce check, not forced to alleviate check, etc.).
@.LP
Multiple kings are allowed in human vs. human setups; however,
only the first one found is examined for being in check.
@.LP
In order to guarantee the ability to write background
chess process save files,
\fInchess\fP changes its working directory to /tmp following
the call to fork() and before the call to execvp().
Thus, chess programs in the former working directory
which were executable only via the '.'
component in the PATH environment variable 
will not be found by execvp().
This bug can be traced to the Unix chess program, which (apparently)
does not allow one to specify an alternative file name for its
save file.

@//E*O*F nchess.6//
chmod u=rw,g=r,o=r nchess.6
 
echo x - decls.h
sed 's/^@//' > "decls.h" <<'@//E*O*F decls.h//'
/*
 * global declarations 
 */

/* board.c */

extern void InitBoard(), DoMove(), UnDoMove(), ShowLastPlay(), 
    SaveGame(), WriteTranscript(), RestoreGame(), DoSetupChange(),
    DoResignation();
extern BOOL InitialTurn, IsOurPieceAt(), IsSrcPieceAt(), 
    IsMoveLegal(), IHaveMoved(), InCheck(), GameOver;
extern Square * GetSquare(), * GetSrcSquare();
extern int PromotePawn(), Turn;

/* boardsw.c */

extern void InitBoardSW(), DrawBoard(), DrawSquare(), AddVictim(),
    DeleteVictim(), KillMouseActivity(), RequestUndo();
extern MouseState Mouse;
extern BOOL Flashing;

/* chessprocess.c */

extern void InitChessProcess(), ReapChessProcesses(), KillChessProcesses(),
    SendMachineMove(), MachineUndo(), MachineRestore(), MachineFirst();
extern BOOL MachineSetup(), MachineDebug;
extern int GetMachineMove(), MachineSave(), ChessProcessFDs[];

/* controlsw.c */

extern void InitControlSW();
extern BOOL SaveWanted;

/* ipc.c */

extern int MyColor, PeerColor;
extern unsigned long PeerProgNum; 
extern void InitRPC(), SendResignation(), SendUndoRequest(), SendTalkMsg(),
    SendRestoreMove(), SendEndRestore(), SendSetupChange(),
    SendUndoAcknowledgement();
extern BOOL UndoWanted, SendMove(), RestoringGame;
extern char * PeerUserName;

/* main.c */

#ifdef FILE
extern FILE * RestoreFile;
#endif
extern int errno, TranscriptType;
extern char * TranscriptFileName, * SaveFileName, * PlayerName[];
extern BOOL SetupMode, IsMachine[2];
extern struct passwd * UserPWEntry;

/* msgsw.c */

extern void InitMsgSW(), Message(), ClearMessage(), WhoseMoveMessage();

/* rpcsw.c */

extern void AddRPCSubwindow(), DeleteRPCSubwindow();

/* select.c */

extern void SelectAll();

/* talksw.c */

extern void RecvTalkMsg(), InitTalkSW();

/* tool.c */

/* the following is a kludge, but hides enormous organizational problems
 * with Sun's headers */
#ifdef TOOL_NULL
extern Tool * NchessTool;
#endif
extern void RunTool(), InitTool(), ParseToolArgs();

/* xdr.c */

extern int XdrGameReq(), XdrMove(), XdrString(), XdrSetup();

/* undeclared system calls and library fxns */

extern int getpid();
extern long random();
extern char * malloc();
@//E*O*F decls.h//
chmod u=r,g=r,o=r decls.h
 
echo x - nchess.h
sed 's/^@//' > "nchess.h" <<'@//E*O*F nchess.h//'
/*
 * network chess header
 */

#define BOOL 			int
#ifndef TRUE
#define TRUE			1
#endif
#ifndef FALSE
#define FALSE			0
#endif

#define	SERVERPROGNUM	((u_long) 0x31233216)	/* RPC daemon program number */
#define VERSNUM			((u_long) 1)	/* RPC version number */

/*
 * daemon procedure numbers
 */
#define	REQPROCNUM		((u_long) 1)	/* game request */
#define	ACKPROCNUM		((u_long) 2)	/* game acknowledge */
#define	CANCELPROCNUM		((u_long) 3)	/* cancel a game request */

/*
 * peer procedure numbers 
 */
#define	ACCEPTPROCNUM		((u_long) 1)	/* game accepted */
#define	MOVEPROCNUM		((u_long) 2)	/* chess move */
#define	COLORFAILPROCNUM	((u_long) 3)	/* color arbitration failure */
#define	UNDOPROCNUM		((u_long) 4)	/* undo request */
#define	RESIGNPROCNUM		((u_long) 5)	/* resignation */
#define	UNDOACKPROCNUM		((u_long) 6)	/* undo request response */
#define	MSGPROCNUM		((u_long) 7)	/* one-liner antagonism */
#define	RESTOREMOVEPROCNUM	((u_long) 8)	/* move during game restoration */
#define	ENDRESTOREPROCNUM	((u_long) 9)	/* restoration/setup complete */
#define	SETUPPROCNUM		((u_long) 10)	/* board setup change */
#define	GOODBYEPROCNUM		((u_long) 11)	/* player killed his tool */

/*
 * color arbitration values - the values are important, as the 
 * game can proceed when the sum of the two players' colors is 
 * WANTSWHITE+WANTSBLACK; also, the values are used as indices 
 * into arrays.
 */
#define	WANTSBLACK		0		/* user wants black */
#define	BLACK			WANTSBLACK	/* user has black */
#define	WANTSWHITE		1		/* user wants white */
#define	WHITE			WANTSWHITE	/* user has white */
#define	EITHERCOLOR		2		/* user doesn't care */

#define	OTHERCOLOR(a)	((a) == WHITE ? BLACK : WHITE)
/*
 * rendezvous information 
 */
typedef struct {
    unsigned long progNum;			/* RPC program number of requester */
    int color;					/* requested color */
    int resumeGame;				/* boolean: wants to resume a game */
    char hostName[256];				/* host name of requester */
    char userName[256];				/* name of requesting user */
} GameRequest;

/*
 * piece move information 
 */
typedef struct {
    int x1;					/* origin square */
    int y1;
    int x2; 					/* destination square */
    int y2;
    int newPieceType;				/* new piece type for 8th rank pawns */
} Move;

/*
 * board square dimensions
 */
#define	SQUARE_WIDTH	64
#define	SQUARE_HEIGHT	SQUARE_WIDTH

/*
 * board coordinates
 */
typedef struct {
    int x;
    int y;
} BoardCoordinate;

/*
 * piece types
 */
typedef enum {
    PAWN = 0,
    KNIGHT,
    BISHOP,
    ROOK,
    QUEEN,
    KING,
    NULLPC,
} PieceType;

/*
 * square state
 */
typedef struct {
    PieceType type;
    int color;
} Square;

/*
 * setup change information 
 */
typedef struct {
    int x;
    int y;
    PieceType type;
    int color;
} SetupChange;

/*
 * mouse (in the board subwindow) activity states
 */
typedef enum {
    IDLE,		/* nada */
    MOVING_PIECE,	/* animating a piece with the left button down */
    PROMOTING_PAWN,	/* selecting a piece type for a pawn promotion */
    CONFIRMING,		/* borrowed for confirmation of something */
    LOCKED,		/* locked (ignored until unlocked) */
    SETUP,		/* setting up a board */
} MouseState;

/*
 * transcript types
 */
#define	TR_MIN_TYPE		0
#define	TR_FORMAL_NORMAL	0	/* P/K2-K4, R/KB3xP/KB5, etc. */
#define	TR_MIN_NORMAL		1	/* P-K4, RxP, etc. */
#define	TR_ALGEBRAIC		2	/* D2D4, etc. */
#define	TR_MAX_TYPE		2

#include "decls.h"

@//E*O*F nchess.h//
chmod u=r,g=r,o=r nchess.h
 
echo x - daemon.c
sed 's/^@//' > "daemon.c" <<'@//E*O*F daemon.c//'
/*
 * chess invitation rendezvous server
 *
 * there are three entry points: 
 * 	- request a game 
 *	- reply to a request
 *	- cancel a request
 */

#include 
#include 
#include 
#include 

#include "nchess.h"

char LocalHostName[256];		/* local host name string */

#define	MAXINVITES	32
typedef struct {			/* registered invitations with call-back information */
    GameRequest gr;			/* call-back information */
    BOOL active;			/* is this slot active? */
    unsigned long time;			/* time invitation was registered */
} Invitation;

Invitation Invitations[MAXINVITES];

/*
 * register a game invitation and print a message on the console.
 */
void
gameRequest(gameReq)
    GameRequest * gameReq;
{
    struct timeval tv;
    struct tm * timep;
    register int i, oldSlot, oldTime;
    register Invitation * invp;
    int avail = -1;
    FILE * console;


    (void) gettimeofday(&tv, (struct timezone *) 0);
    timep = localtime((long *) &tv.tv_sec);
    oldTime = tv.tv_sec;
    /* find an empty invitation slot, keeping track of the oldest active one */
    for (i = 0 ; i < MAXINVITES ; i++) {
	invp = &Invitations[i];
	if ( ! invp->active) {
	    avail = i;
	    break;
	} else if (invp->time < oldTime) {
	    oldSlot = i;
	    oldTime = invp->time;
	}
    }
    /* if no slots are empty, re-use the oldest one */
    if (avail < 0) 
	avail = oldSlot;
    /* fill out the invitation slot */
    invp = &Invitations[avail];
    invp->active = TRUE;
    invp->time = tv.tv_sec;
    invp->gr.progNum = gameReq->progNum;
    invp->gr.color = gameReq->color;
    invp->gr.resumeGame = gameReq->resumeGame;
    strncpy(invp->gr.hostName, gameReq->hostName, sizeof(gameReq->hostName));
    strncpy(invp->gr.userName, gameReq->userName, sizeof(gameReq->userName));
    /* 
     * print the invitation message on the local console 
     */
    if ((console = fopen("/dev/console", "w")) != (FILE *) 0) {
	fprintf(console, "\n\007\007\007Message from Chess Daemon@%s at %d:%02d ...\n", 
	    LocalHostName, timep->tm_hour, timep->tm_min);
	if (gameReq->resumeGame) 
	    fprintf(console, "%s wants to resume a game of chess.\n", 
		gameReq->userName);
	else
	    fprintf(console, "%s wants to play a game of chess.\n", 
		gameReq->userName);
	fprintf(console, "reply with: nchess %s@%s\n", 
	    gameReq->userName, gameReq->hostName);
	fflush (console);
	fclose(console);
    }
}

/*
 * attempt to respond to a game invitation 
 */
GameRequest *
gameAcknowledge(gameAck)
    GameRequest * gameAck;
{
    static GameRequest gr;
    register int i, newestTime = 0, newestIndex = -1;
    
    /* 
     * look for the most recently registered invitation
     * if one exists, return the prog. number and the color,
     *		then remove the entry.
     * else return an entry with a program number of zero.
     */
    gr.progNum = 0;
    for (i = 0 ; i < MAXINVITES && Invitations[i].active ; i++) {
	if (strcmp(Invitations[i].gr.hostName, gameAck->hostName) == 0
	&& strcmp(Invitations[i].gr.userName, gameAck->userName) == 0
	&& Invitations[i].time > newestTime) {
	    newestIndex = i;
	    newestTime = Invitations[i].time;
	}
    }
    if (newestIndex >= 0) {
	gr.progNum = Invitations[newestIndex].gr.progNum;
	gr.color = Invitations[newestIndex].gr.color;
	gr.resumeGame = Invitations[newestIndex].gr.resumeGame;
	Invitations[newestIndex].active = FALSE;
    }
    return(&gr);
}

/*
 * cancel a game invitation 
 */
void
cancelRequest(gr)
    GameRequest * gr;
{
    register int i;
    
    for (i = 0 ; i < MAXINVITES && Invitations[i].active ; i++) {
	if (strcmp(Invitations[i].gr.hostName, gr->hostName) == 0
	&& strcmp(Invitations[i].gr.userName, gr->userName) == 0
	&& Invitations[i].gr.progNum == gr->progNum) {
	    Invitations[i].active = FALSE;
	    break;
	}
    }
}

/*ARGSUSED*/
main(argc, argv)
    int argc;
    char ** argv;
{
    if (gethostname(LocalHostName, sizeof(LocalHostName)) != 0) {
	fprintf(stderr, "%s: can't determine the local host name\n", argv[0]);
	exit(1);
    }
    pmap_unset(SERVERPROGNUM, VERSNUM);
    /* register the entry points */
    registerrpc(SERVERPROGNUM, VERSNUM, REQPROCNUM, 
	gameRequest, XdrGameReq, xdr_void);
    registerrpc(SERVERPROGNUM, VERSNUM, ACKPROCNUM, 
	gameAcknowledge, XdrGameReq, XdrGameReq);
    registerrpc(SERVERPROGNUM, VERSNUM, CANCELPROCNUM, 
	cancelRequest, XdrGameReq, xdr_void);
    svc_run();
    fprintf(stderr, "%s: exiting - svc_run returned\n", argv[0]);
    exit(1);
}

@//E*O*F daemon.c//
chmod u=r,g=r,o=r daemon.c
 
echo x - xdr.c
sed 's/^@//' > "xdr.c" <<'@//E*O*F xdr.c//'
/*
 * specialized xdr stuff
 */

#include 
#include 

#include "nchess.h"

int
XdrGameReq(xdrsp, grp)
    XDR * xdrsp;
    GameRequest * grp;
{
    unsigned int size;
    char * cp;

    if ( ! xdr_u_long(xdrsp, &grp->progNum))
	return(0);
    if ( ! xdr_int(xdrsp, &grp->color))
	return(0);
    if ( ! xdr_int(xdrsp, &grp->resumeGame))
	return(0);
    size = sizeof(grp->hostName);
    cp = grp->hostName;
    if ( ! xdr_bytes(xdrsp, &cp, &size, size))
	return(0);
    size = sizeof(grp->userName);
    cp = grp->userName;
    if ( ! xdr_bytes(xdrsp, &cp, &size, size))
	return(0);
    return(1);
}

int
XdrMove(xdrsp, movep)
    XDR * xdrsp;
    Move * movep;
{
    if ( ! xdr_int(xdrsp, &movep->x1))
	return(0);
    if ( ! xdr_int(xdrsp, &movep->y1))
	return(0);
    if ( ! xdr_int(xdrsp, &movep->x2))
	return(0);
    if ( ! xdr_int(xdrsp, &movep->y2))
	return(0);
    if ( ! xdr_int(xdrsp, &movep->newPieceType))
	return(0);
    return(1);
}

int
XdrSetup(xdrsp, setup)
    XDR * xdrsp;
    SetupChange * setup;
{
    if ( ! xdr_int(xdrsp, &setup->x))
	return(0);
    if ( ! xdr_int(xdrsp, &setup->y))
	return(0);
    if ( ! xdr_int(xdrsp, (int *) &setup->type))
	return(0);
    if ( ! xdr_int(xdrsp, &setup->color))
	return(0);
    return(1);
}

int
XdrString(xdrsp, cp)
    XDR * xdrsp;
    char * cp;
{
    char c[128];
    strncpy(c, cp, sizeof(c));
    c[127] = '\0';
    if ( ! xdr_string(xdrsp, &cp, sizeof(c)))
	return(0);
    return(1);
}
@//E*O*F xdr.c//
chmod u=r,g=r,o=r xdr.c
 
echo mkdir - Icons
mkdir Icons
chmod u=rwx,g=rx,o=rx Icons
 
echo x - Icons/bishop.icon
sed 's/^@//' > "Icons/bishop.icon" <<'@//E*O*F Icons/bishop.icon//'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x000C,0x3000,0x0000,0x0000,0x000C,0x3000,0x0000,
	0x0000,0x001E,0x7800,0x0000,0x0000,0x003F,0x7C00,0x0000,
	0x0000,0x003F,0xBC00,0x0000,0x0000,0x007F,0xDE00,0x0000,
	0x0000,0x007F,0xEE00,0x0000,0x0000,0x00FF,0xEF00,0x0000,
	0x0000,0x01FF,0xF780,0x0000,0x0000,0x01FF,0xFB80,0x0000,
	0x0000,0x03FF,0xFBC0,0x0000,0x0000,0x03FF,0xFDC0,0x0000,
	0x0000,0x07FF,0xFEE0,0x0000,0x0000,0x07FF,0xFEE0,0x0000,
	0x0000,0x0FFF,0xFF70,0x0000,0x0000,0x0FFC,0x7FB0,0x0000,
	0x0000,0x1FFC,0x7FB8,0x0000,0x0000,0x1FFC,0x7FD8,0x0000,
	0x0000,0x1FFC,0x7FD8,0x0000,0x0000,0x1FFC,0x7FE8,0x0000,
	0x0000,0x3FFC,0x7FEC,0x0000,0x0000,0x3FFC,0x7FF4,0x0000,
	0x0000,0x3F80,0x03F4,0x0000,0x0000,0x3F80,0x03F8,0x0000,
	0x0000,0x3FFC,0x7FF8,0x0000,0x0000,0x3FFC,0x7FFC,0x0000,
	0x0000,0x3FFC,0x7FFC,0x0000,0x0000,0x3FFC,0x7FFC,0x0000,
	0x0000,0x3FFC,0x7FFC,0x0000,0x0000,0x3FFC,0x7FFC,0x0000,
	0x0000,0x3FFC,0x7FFC,0x0000,0x0000,0x1FFC,0x7FF8,0x0000,
	0x0000,0x1FFC,0x7FF8,0x0000,0x0000,0x1FFC,0x7FF8,0x0000,
	0x0000,0x1FFC,0x7FF8,0x0000,0x0000,0x1FFC,0x7FF8,0x0000,
	0x0000,0x0FFC,0x7FF0,0x0000,0x0000,0x0FFC,0x7FF0,0x0000,
	0x0000,0x0FFC,0x7FF0,0x0000,0x0000,0x07FF,0xFFE0,0x0000,
	0x0000,0x07FF,0xFFE0,0x0000,0x0000,0x07FF,0xFFE0,0x0000,
	0x0000,0x03FF,0xFFC0,0x0000,0x0000,0x03FF,0xFFC0,0x0000,
	0x0000,0x03FF,0xFFC0,0x0000,0x0000,0x03FF,0xFFC0,0x0000,
	0x0000,0x03FF,0xFFC0,0x0000,0x0000,0x03FF,0xFFC0,0x0000,
	0x0000,0xFFFF,0xFFFF,0x0000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0001,0x8000,0x0001,0x8000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0001,0xFFFF,0xFFFF,0x8000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0001,0x8000,0x0001,0x8000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0000,0xFFFF,0xFFFF,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
@//E*O*F Icons/bishop.icon//
chmod u=rw,g=r,o=r Icons/bishop.icon
 
echo x - Icons/bishopStencil.icon
sed 's/^@//' > "Icons/bishopStencil.icon" <<'@//E*O*F Icons/bishopStencil.icon//'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x000C,0x3000,0x0000,
	0x0000,0x001E,0x7800,0x0000,0x0000,0x001E,0x7800,0x0000,
	0x0000,0x003F,0xFC00,0x0000,0x0000,0x007F,0xFE00,0x0000,
	0x0000,0x007F,0xFE00,0x0000,0x0000,0x00FF,0xFF00,0x0000,
	0x0000,0x00FF,0xFF00,0x0000,0x0000,0x01FF,0xFF80,0x0000,
	0x0000,0x03FF,0xFFC0,0x0000,0x0000,0x03FF,0xFFC0,0x0000,
	0x0000,0x07FF,0xFFE0,0x0000,0x0000,0x07FF,0xFFE0,0x0000,
	0x0000,0x0FFF,0xFFF0,0x0000,0x0000,0x0FFF,0xFFF0,0x0000,
	0x0000,0x1FFF,0xFFF8,0x0000,0x0000,0x1FFF,0xFFF8,0x0000,
	0x0000,0x3FFF,0xFFFC,0x0000,0x0000,0x3FFF,0xFFFC,0x0000,
	0x0000,0x3FFF,0xFFFC,0x0000,0x0000,0x3FFF,0xFFFC,0x0000,
	0x0000,0x7FFF,0xFFFE,0x0000,0x0000,0x7FFF,0xFFFE,0x0000,
	0x0000,0x7FFF,0xFFFE,0x0000,0x0000,0x7FFF,0xFFFE,0x0000,
	0x0000,0x7FFF,0xFFFE,0x0000,0x0000,0x7FFF,0xFFFE,0x0000,
	0x0000,0x7FFF,0xFFFE,0x0000,0x0000,0x7FFF,0xFFFE,0x0000,
	0x0000,0x7FFF,0xFFFE,0x0000,0x0000,0x7FFF,0xFFFE,0x0000,
	0x0000,0x7FFF,0xFFFE,0x0000,0x0000,0x3FFF,0xFFFC,0x0000,
	0x0000,0x3FFF,0xFFFC,0x0000,0x0000,0x3FFF,0xFFFC,0x0000,
	0x0000,0x3FFF,0xFFFC,0x0000,0x0000,0x3FFF,0xFFFC,0x0000,
	0x0000,0x1FFF,0xFFF8,0x0000,0x0000,0x1FFF,0xFFF8,0x0000,
	0x0000,0x1FFF,0xFFF8,0x0000,0x0000,0x0FFF,0xFFF0,0x0000,
	0x0000,0x0FFF,0xFFF0,0x0000,0x0000,0x0FFF,0xFFF0,0x0000,
	0x0000,0x07FF,0xFFE0,0x0000,0x0000,0x07FF,0xFFE0,0x0000,
	0x0000,0x07FF,0xFFE0,0x0000,0x0000,0x07FF,0xFFE0,0x0000,
	0x0000,0x07FF,0xFFE0,0x0000,0x0000,0xFFFF,0xFFFF,0x0000,
	0x0001,0xFFFF,0xFFFF,0x8000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0003,0xFFFF,0xFFFF,0xC000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0003,0xFFFF,0xFFFF,0xC000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0003,0xFFFF,0xFFFF,0xC000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0001,0xFFFF,0xFFFF,0x8000,0x0000,0xFFFF,0xFFFF,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
@//E*O*F Icons/bishopStencil.icon//
chmod u=rw,g=r,o=r Icons/bishopStencil.icon
 
echo x - Icons/king.icon
sed 's/^@//' > "Icons/king.icon" <<'@//E*O*F Icons/king.icon//'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,
	0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,
	0x0000,0x0003,0xC000,0x0000,0x0000,0x0003,0xC000,0x0000,
	0x0000,0x0006,0x6000,0x0000,0x0000,0x0006,0x6000,0x0000,
	0x0000,0x0006,0x6000,0x0000,0x0000,0x0F83,0xC1F0,0x0000,
	0x0000,0x7FE3,0xC7FE,0x0000,0x0001,0xFFF9,0x9FFF,0x8000,
	0x0003,0xFFFD,0xBFFF,0xC000,0x0007,0xFFFF,0xFFFF,0xE000,
	0x000F,0xFFFF,0xFFFF,0xF000,0x000F,0xFFFF,0xFFFF,0xF000,
	0x001F,0xFFFF,0xFFFF,0xF800,0x001F,0xFFFF,0xFFFF,0xF800,
	0x003F,0xFFFF,0xFFFF,0xFC00,0x003F,0xFC7F,0xFE3F,0xFC00,
	0x003F,0xF00F,0xF00F,0xFC00,0x007F,0xF1E7,0xE78F,0xFE00,
	0x007F,0xE3FB,0xDFC7,0xFE00,0x007F,0xE7FF,0xFFE7,0xFE00,
	0x007F,0xE7FF,0xFFE7,0xFE00,0x007F,0xE7FF,0xFFE7,0xFE00,
	0x007F,0xE7FF,0xFFE7,0xFE00,0x007F,0xE7FF,0xFFE7,0xFE00,
	0x007F,0xE3FF,0xFFC7,0xFE00,0x007F,0xF3FF,0xFFCF,0xFE00,
	0x007F,0xF3FF,0xFFCF,0xFE00,0x003F,0xF9FF,0xFF9F,0xFC00,
	0x003F,0xF9FF,0xFF9F,0xFC00,0x003F,0xFCFF,0xFF3F,0xFC00,
	0x001F,0xFCFF,0xFF3F,0xF800,0x001F,0xFE7F,0xFE7F,0xF800,
	0x000F,0xFF7F,0xFEFF,0xF000,0x0007,0xFFBF,0xFDFF,0xE000,
	0x0003,0xFFFF,0xFFFF,0xC000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0001,0xFFFF,0xFFFF,0x8000,0x0000,0xFFFF,0xFFFF,0x0000,
	0x0000,0xFFFF,0xFFFF,0x0000,0x0000,0x7FFF,0xFFFE,0x0000,
	0x0000,0x7FFF,0xFFFE,0x0000,0x0000,0x7FFF,0xFFFE,0x0000,
	0x0000,0xFFFF,0xFFFF,0x0000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0001,0x8000,0x0001,0x8000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0001,0xFFFF,0xFFFF,0x8000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0001,0x8000,0x0001,0x8000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0000,0xFFFF,0xFFFF,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
@//E*O*F Icons/king.icon//
chmod u=rw,g=r,o=r Icons/king.icon
 
echo x - Icons/kingStencil.icon
sed 's/^@//' > "Icons/kingStencil.icon" <<'@//E*O*F Icons/kingStencil.icon//'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0001,0x8000,0x0000,
	0x0000,0x0003,0xC000,0x0000,0x0000,0x0003,0xC000,0x0000,
	0x0000,0x0003,0xC000,0x0000,0x0000,0x0003,0xC000,0x0000,
	0x0000,0x0007,0xE000,0x0000,0x0000,0x0007,0xE000,0x0000,
	0x0000,0x000F,0xF000,0x0000,0x0000,0x000F,0xF000,0x0000,
	0x0000,0x0F8F,0xF1F0,0x0000,0x0000,0x7FE7,0xE7FE,0x0000,
	0x0001,0xFFFB,0xDFFF,0x8000,0x0003,0xFFFD,0xBFFF,0xC000,
	0x0007,0xFFFF,0xFFFF,0xE000,0x000F,0xFFFF,0xFFFF,0xF000,
	0x001F,0xFFFF,0xFFFF,0xF800,0x001F,0xFFFF,0xFFFF,0xF800,
	0x003F,0xFFFF,0xFFFF,0xFC00,0x003F,0xFFFF,0xFFFF,0xFC00,
	0x007F,0xFFFF,0xFFFF,0xFE00,0x007F,0xFFFF,0xFFFF,0xFE00,
	0x007F,0xFFFF,0xFFFF,0xFE00,0x00FF,0xFFFF,0xFFFF,0xFF00,
	0x00FF,0xFFFF,0xFFFF,0xFF00,0x00FF,0xFFFF,0xFFFF,0xFF00,
	0x00FF,0xFFFF,0xFFFF,0xFF00,0x00FF,0xFFFF,0xFFFF,0xFF00,
	0x00FF,0xFFFF,0xFFFF,0xFF00,0x00FF,0xFFFF,0xFFFF,0xFF00,
	0x00FF,0xFFFF,0xFFFF,0xFF00,0x00FF,0xFFFF,0xFFFF,0xFF00,
	0x00FF,0xFFFF,0xFFFF,0xFF00,0x007F,0xFFFF,0xFFFF,0xFE00,
	0x007F,0xFFFF,0xFFFF,0xFE00,0x007F,0xFFFF,0xFFFF,0xFE00,
	0x003F,0xFFFF,0xFFFF,0xFC00,0x003F,0xFFFF,0xFFFF,0xFC00,
	0x001F,0xFFFF,0xFFFF,0xF800,0x000F,0xFFFF,0xFFFF,0xF000,
	0x0007,0xFFFF,0xFFFF,0xE000,0x0007,0xFFFF,0xFFFF,0xE000,
	0x0003,0xFFFF,0xFFFF,0xC000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0001,0xFFFF,0xFFFF,0x8000,0x0000,0xFFFF,0xFFFF,0x0000,
	0x0000,0xFFFF,0xFFFF,0x0000,0x0000,0xFFFF,0xFFFF,0x0000,
	0x0001,0xFFFF,0xFFFF,0x8000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0003,0xFFFF,0xFFFF,0xC000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0003,0xFFFF,0xFFFF,0xC000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0003,0xFFFF,0xFFFF,0xC000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0001,0xFFFF,0xFFFF,0xC000,0x0000,0xFFFF,0xFFFF,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
@//E*O*F Icons/kingStencil.icon//
chmod u=rw,g=r,o=r Icons/kingStencil.icon
 
echo x - Icons/knight.icon
sed 's/^@//' > "Icons/knight.icon" <<'@//E*O*F Icons/knight.icon//'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0ADA,0xC000,0x0000,
	0x0000,0xBE55,0x8018,0x0000,0x0000,0xCDFB,0x70F8,0x0000,
	0x0001,0x77FF,0xDBD0,0x0000,0x0002,0xDFFF,0x3FA0,0x0000,
	0x0004,0xBFFF,0xFE40,0x0000,0x000E,0xB7FF,0xFC80,0x0000,
	0x0017,0x7FFF,0xFD80,0x0000,0x0012,0xFFFF,0xFFE0,0x0000,
	0x003A,0xDFFF,0xFFF0,0x0000,0x004F,0xFFFF,0xFFF8,0x0000,
	0x0076,0xFFFF,0xFFFC,0x0000,0x005D,0xFFFF,0xFFFE,0x0000,
	0x004D,0xFFFF,0xFFBC,0x0000,0x006D,0xFFFF,0xFF9C,0x0000,
	0x007F,0xFFFF,0xFFBC,0x0000,0x00D7,0xFFFF,0xFFFE,0x0000,
	0x005D,0xFFFF,0xFFFF,0x0000,0x0077,0xFFEF,0xFFFF,0x8000,
	0x00D5,0xFFEF,0xFFFF,0xC000,0x005F,0xFFF7,0xFFFF,0xE000,
	0x01B7,0xFFFB,0xFFFF,0xF000,0x00EF,0xFFFD,0xFFF7,0xF000,
	0x0077,0xFFFE,0x7FFB,0xF800,0x00DF,0xFFFE,0x1FFD,0xF800,
	0x00B5,0xFFFF,0x007E,0xF800,0x00DF,0xFFFF,0x801F,0x7800,
	0x0077,0xFFFF,0x800F,0xB000,0x00DF,0xFFFF,0xC007,0xC000,
	0x00BB,0xFFFF,0xC003,0x8000,0x00AF,0xFFFF,0xE000,0x0000,
	0x0077,0xFFFF,0xF000,0x0000,0x00DF,0xFFFF,0xF800,0x0000,
	0x00BB,0xFFFF,0xFC00,0x0000,0x00EF,0xFFFF,0xFC00,0x0000,
	0x0057,0xFFFF,0xFE00,0x0000,0x0035,0xFFFF,0xFF00,0x0000,
	0x005B,0xFFFF,0xFF00,0x0000,0x002E,0xFFFF,0xFF80,0x0000,
	0x0027,0x7FFF,0xFF80,0x0000,0x001D,0xFFFF,0xFFC0,0x0000,
	0x000B,0x7FFF,0xFFE0,0x0000,0x000A,0xFFFF,0xFFF0,0x0000,
	0x000F,0xBFFF,0xFFF0,0x0000,0x0002,0xFFFF,0xFFF8,0x0000,
	0x0001,0x3FFF,0xFFFC,0x0000,0x0000,0xFFFF,0xFFFC,0x0000,
	0x0000,0xFFFF,0xFFFF,0x0000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0001,0x8000,0x0001,0x8000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0001,0xFFFF,0xFFFF,0x8000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0001,0x8000,0x0001,0x8000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0000,0xFFFF,0xFFFF,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
@//E*O*F Icons/knight.icon//
chmod u=rw,g=r,o=r Icons/knight.icon
 
echo x - Icons/knightStencil.icon
sed 's/^@//' > "Icons/knightStencil.icon" <<'@//E*O*F Icons/knightStencil.icon//'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0DB6,0xC000,0x0000,0x0000,0x1FFF,0xE01C,0x0000,
	0x0001,0x7FFF,0xF8FC,0x0000,0x0001,0xFFFF,0xFBFC,0x0000,
	0x0002,0xFFFF,0xFFF8,0x0000,0x0005,0xFFFF,0xFFF0,0x0000,
	0x000F,0xFFFF,0xFFE0,0x0000,0x0017,0xFFFF,0xFFC0,0x0000,
	0x000F,0xFFFF,0xFFE0,0x0000,0x002F,0xFFFF,0xFFF0,0x0000,
	0x005F,0xFFFF,0xFFF8,0x0000,0x00BF,0xFFFF,0xFFFC,0x0000,
	0x00FF,0xFFFF,0xFFFE,0x0000,0x007F,0xFFFF,0xFFFF,0x0000,
	0x00FF,0xFFFF,0xFFFE,0x0000,0x007F,0xFFFF,0xFFFE,0x0000,
	0x00FF,0xFFFF,0xFFFE,0x0000,0x017F,0xFFFF,0xFFFF,0x0000,
	0x00FF,0xFFFF,0xFFFF,0x8000,0x01FF,0xFFFF,0xFFFF,0xC000,
	0x007F,0xFFFF,0xFFFF,0xE000,0x01FF,0xFFFF,0xFFFF,0xF000,
	0x00FF,0xFFFF,0xFFFF,0xF800,0x01FF,0xFFFF,0xFFFF,0xF800,
	0x01FF,0xFFFF,0xFFFF,0xFC00,0x00FF,0xFFFF,0x7FFF,0xFC00,
	0x01FF,0xFFFF,0x9FFF,0xFC00,0x01FF,0xFFFF,0xC07F,0xFC00,
	0x00FF,0xFFFF,0xC01F,0xF800,0x01FF,0xFFFF,0xE00F,0xF000,
	0x01FF,0xFFFF,0xE007,0xC000,0x00FF,0xFFFF,0xF003,0x8000,
	0x01FF,0xFFFF,0xF800,0x0000,0x01FF,0xFFFF,0xFC00,0x0000,
	0x00FF,0xFFFF,0xFE00,0x0000,0x01FF,0xFFFF,0xFE00,0x0000,
	0x01FF,0xFFFF,0xFF00,0x0000,0x00FF,0xFFFF,0xFF80,0x0000,
	0x00BF,0xFFFF,0xFF80,0x0000,0x007F,0xFFFF,0xFFC0,0x0000,
	0x003F,0xFFFF,0xFFC0,0x0000,0x002F,0xFFFF,0xFFE0,0x0000,
	0x003F,0xFFFF,0xFFF0,0x0000,0x000F,0xFFFF,0xFFF8,0x0000,
	0x001F,0xFFFF,0xFFF8,0x0000,0x001F,0xFFFF,0xFFFC,0x0000,
	0x0007,0xFFFF,0xFFFE,0x0000,0x0000,0xFFFF,0xFFFF,0x0000,
	0x0001,0xFFFF,0xFFFF,0x8000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0003,0xFFFF,0xFFFF,0xC000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0003,0xFFFF,0xFFFF,0xC000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0003,0xFFFF,0xFFFF,0xC000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0001,0xFFFF,0xFFFF,0x8000,0x0000,0xFFFF,0xFFFF,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
@//E*O*F Icons/knightStencil.icon//
chmod u=rw,g=r,o=r Icons/knightStencil.icon
 
echo x - Icons/pawn.icon
sed 's/^@//' > "Icons/pawn.icon" <<'@//E*O*F Icons/pawn.icon//'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0001,0x8000,0x0000,
	0x0000,0x0007,0xE000,0x0000,0x0000,0x000F,0xF000,0x0000,
	0x0000,0x001F,0xF800,0x0000,0x0000,0x003F,0xFC00,0x0000,
	0x0000,0x003F,0xFC00,0x0000,0x0000,0x003F,0xFC00,0x0000,
	0x0000,0x003F,0xFC00,0x0000,0x0000,0x003F,0xFC00,0x0000,
	0x0000,0x001F,0xF800,0x0000,0x0000,0x000F,0xF000,0x0000,
	0x0000,0x0007,0xE000,0x0000,0x0000,0x0003,0xC000,0x0000,
	0x0000,0x0003,0xC000,0x0000,0x0000,0x0003,0xC000,0x0000,
	0x0000,0x0003,0xC000,0x0000,0x0000,0x0003,0xC000,0x0000,
	0x0000,0x0003,0xC000,0x0000,0x0000,0x0003,0xC000,0x0000,
	0x0000,0x0003,0xC000,0x0000,0x0000,0x0007,0xE000,0x0000,
	0x0000,0x0007,0xE000,0x0000,0x0000,0x0007,0xE000,0x0000,
	0x0000,0x0007,0xE000,0x0000,0x0000,0x0007,0xE000,0x0000,
	0x0000,0x000F,0xF000,0x0000,0x0000,0x000F,0xF000,0x0000,
	0x0000,0x000F,0xF000,0x0000,0x0000,0x000F,0xF000,0x0000,
	0x0000,0x001F,0xF800,0x0000,0x0000,0x001F,0xF800,0x0000,
	0x0000,0x001F,0xF800,0x0000,0x0000,0x003F,0xFC00,0x0000,
	0x0000,0x003F,0xFC00,0x0000,0x0000,0x007F,0xFE00,0x0000,
	0x0000,0x00FF,0xFF00,0x0000,0x0000,0x01FF,0xFF80,0x0000,
	0x0000,0x03FF,0xFFC0,0x0000,0x0000,0x0FFF,0xFFF0,0x0000,
	0x0000,0x3FFF,0xFFFC,0x0000,0x0000,0x7FFF,0xFFFE,0x0000,
	0x0000,0x7000,0x000E,0x0000,0x0000,0x7FFF,0xFFFE,0x0000,
	0x0000,0x7FFF,0xFFFE,0x0000,0x0000,0x7FFF,0xFFFE,0x0000,
	0x0000,0x7000,0x000E,0x0000,0x0000,0x7FFF,0xFFFE,0x0000,
	0x0000,0x3FFF,0xFFFC,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
@//E*O*F Icons/pawn.icon//
chmod u=rw,g=r,o=r Icons/pawn.icon
 
echo x - Icons/pawnStencil.icon
sed 's/^@//' > "Icons/pawnStencil.icon" <<'@//E*O*F Icons/pawnStencil.icon//'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0001,0x8000,0x0000,0x0000,0x0007,0xE000,0x0000,
	0x0000,0x000F,0xF000,0x0000,0x0000,0x001F,0xF800,0x0000,
	0x0000,0x003F,0xFC00,0x0000,0x0000,0x007F,0xFE00,0x0000,
	0x0000,0x007F,0xFE00,0x0000,0x0000,0x007F,0xFE00,0x0000,
	0x0000,0x007F,0xFE00,0x0000,0x0000,0x007F,0xFE00,0x0000,
	0x0000,0x003F,0xFC00,0x0000,0x0000,0x001F,0xF800,0x0000,
	0x0000,0x000F,0xF000,0x0000,0x0000,0x0007,0xE000,0x0000,
	0x0000,0x0007,0xE000,0x0000,0x0000,0x0007,0xE000,0x0000,
	0x0000,0x0007,0xE000,0x0000,0x0000,0x0007,0xE000,0x0000,
	0x0000,0x0007,0xE000,0x0000,0x0000,0x0007,0xE000,0x0000,
	0x0000,0x0007,0xE000,0x0000,0x0000,0x000F,0xF000,0x0000,
	0x0000,0x000F,0xF000,0x0000,0x0000,0x000F,0xF000,0x0000,
	0x0000,0x000F,0xF000,0x0000,0x0000,0x000F,0xF000,0x0000,
	0x0000,0x001F,0xF800,0x0000,0x0000,0x001F,0xF800,0x0000,
	0x0000,0x001F,0xF800,0x0000,0x0000,0x001F,0xF800,0x0000,
	0x0000,0x003F,0xFC00,0x0000,0x0000,0x003F,0xFC00,0x0000,
	0x0000,0x003F,0xFC00,0x0000,0x0000,0x007F,0xFE00,0x0000,
	0x0000,0x007F,0xFE00,0x0000,0x0000,0x00FF,0xFF00,0x0000,
	0x0000,0x01FF,0xFF80,0x0000,0x0000,0x03FF,0xFFC0,0x0000,
	0x0000,0x0FFF,0xFFF0,0x0000,0x0000,0x3FFF,0xFFFC,0x0000,
	0x0000,0x7FFF,0xFFFE,0x0000,0x0000,0xFFFF,0xFFFF,0x0000,
	0x0000,0xFFFF,0xFFFF,0x0000,0x0000,0xFFFF,0xFFFF,0x0000,
	0x0000,0xFFFF,0xFFFF,0x0000,0x0000,0xFFFF,0xFFFF,0x0000,
	0x0000,0xFFFF,0xFFFF,0x0000,0x0000,0xFFFF,0xFFFF,0x0000,
	0x0000,0x7FFF,0xFFFE,0x0000,0x0000,0x3FFF,0xFFFC,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
@//E*O*F Icons/pawnStencil.icon//
chmod u=rw,g=r,o=r Icons/pawnStencil.icon
 
echo x - Icons/queen.icon
sed 's/^@//' > "Icons/queen.icon" <<'@//E*O*F Icons/queen.icon//'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,
	0x0000,0x0003,0xC000,0x0000,0x0000,0x0003,0xC000,0x0000,
	0x0000,0x0007,0xE000,0x0000,0x0000,0x0007,0xE000,0x0000,
	0x0000,0x000F,0xF000,0x0000,0x0000,0x000F,0xF000,0x0000,
	0x0000,0x001F,0xF800,0x0000,0x0000,0x001F,0xF800,0x0000,
	0x0000,0x003F,0xFC00,0x0000,0x0000,0x003F,0xFC00,0x0000,
	0x0000,0x007F,0xFE00,0x0000,0x0000,0x007F,0xFE00,0x0000,
	0x0000,0x00FF,0xFF00,0x0000,0x0020,0x00FF,0xFF00,0x0400,
	0x0030,0x01FF,0xFF80,0x0C00,0x0038,0x01FF,0xFF80,0x1C00,
	0x003C,0x03FF,0xFFC0,0x3C00,0x003C,0x03FF,0xFFC0,0x3C00,
	0x001E,0x07FE,0x7FE0,0x7800,0x001F,0x07FE,0x7FE0,0xF800,
	0x001F,0x8FFC,0x3FF1,0xF800,0x001F,0x8FFC,0x3FF1,0xF800,
	0x000F,0xDFF8,0x1FFB,0xF000,0x000F,0xFFF9,0x9FFF,0xF000,
	0x000F,0xFFF1,0x8FFF,0xF000,0x000F,0xFFF3,0xCFFF,0xF000,
	0x0007,0xFFE3,0xC7FF,0xE000,0x0007,0xFFE7,0xE7FF,0xE000,
	0x0007,0xFFC7,0xE3FF,0xE000,0x0007,0xFFCF,0xF3FF,0xE000,
	0x0007,0xFFE7,0xE7FF,0xE000,0x0003,0xFFE7,0xE7FF,0xC000,
	0x0003,0xFFF3,0xCFFF,0xC000,0x0003,0xFFF3,0xCFFF,0xC000,
	0x0003,0xFFF9,0x9FFF,0xC000,0x0001,0xFFF9,0x9FFF,0x8000,
	0x0001,0xFFFC,0x3FFF,0x8000,0x0001,0xFFFC,0x3FFF,0x8000,
	0x0001,0xFFFE,0x7FFF,0x8000,0x0000,0xFFFE,0x7FFF,0x0000,
	0x0000,0xFFFF,0xFFFF,0x0000,0x0000,0xFFFF,0xFFFF,0x0000,
	0x0000,0xFFFF,0xFFFF,0x0000,0x0000,0x7FFF,0xFFFE,0x0000,
	0x0000,0x7FFF,0xFFFE,0x0000,0x0000,0x7FFF,0xFFFE,0x0000,
	0x0000,0xFFFF,0xFFFF,0x0000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0001,0x8000,0x0001,0x8000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0001,0xFFFF,0xFFFF,0x8000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0001,0x8000,0x0001,0x8000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0000,0xFFFF,0xFFFF,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
@//E*O*F Icons/queen.icon//
chmod u=rw,g=r,o=r Icons/queen.icon
 
echo x - Icons/queenStencil.icon
sed 's/^@//' > "Icons/queenStencil.icon" <<'@//E*O*F Icons/queenStencil.icon//'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0001,0x8000,0x0000,
	0x0000,0x0003,0xC000,0x0000,0x0000,0x0003,0xC000,0x0000,
	0x0000,0x0007,0xE000,0x0000,0x0000,0x0007,0xE000,0x0000,
	0x0000,0x000F,0xF000,0x0000,0x0000,0x000F,0xF000,0x0000,
	0x0000,0x001F,0xF800,0x0000,0x0000,0x001F,0xF800,0x0000,
	0x0000,0x003F,0xFC00,0x0000,0x0000,0x003F,0xFC00,0x0000,
	0x0000,0x007F,0xFE00,0x0000,0x0000,0x007F,0xFE00,0x0000,
	0x0000,0x00FF,0xFF00,0x0000,0x0040,0x00FF,0xFF00,0x0200,
	0x0060,0x01FF,0xFF80,0x0600,0x0070,0x01FF,0xFF80,0x0E00,
	0x0078,0x03FF,0xFFC0,0x1E00,0x007C,0x03FF,0xFFC0,0x3E00,
	0x007E,0x07FF,0xFFE0,0x7E00,0x007E,0x07FF,0xFFE0,0x7E00,
	0x003F,0x0FFF,0xFFF0,0xFC00,0x003F,0x8FFF,0xFFF1,0xFC00,
	0x003F,0xDFFF,0xFFFB,0xFC00,0x003F,0xDFFF,0xFFFB,0xFC00,
	0x001F,0xFFFF,0xFFFF,0xF800,0x001F,0xFFFF,0xFFFF,0xF800,
	0x001F,0xFFFF,0xFFFF,0xF800,0x001F,0xFFFF,0xFFFF,0xF800,
	0x000F,0xFFFF,0xFFFF,0xF000,0x000F,0xFFFF,0xFFFF,0xF000,
	0x000F,0xFFFF,0xFFFF,0xF000,0x000F,0xFFFF,0xFFFF,0xF000,
	0x000F,0xFFFF,0xFFFF,0xF000,0x0007,0xFFFF,0xFFFF,0xE000,
	0x0007,0xFFFF,0xFFFF,0xE000,0x0007,0xFFFF,0xFFFF,0xE000,
	0x0007,0xFFFF,0xFFFF,0xE000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0003,0xFFFF,0xFFFF,0xC000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0003,0xFFFF,0xFFFF,0xC000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0001,0xFFFF,0xFFFF,0x8000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0001,0xFFFF,0xFFFF,0x8000,0x0000,0xFFFF,0xFFFF,0x0000,
	0x0000,0xFFFF,0xFFFF,0x0000,0x0000,0xFFFF,0xFFFF,0x0000,
	0x0001,0xFFFF,0xFFFF,0x8000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0003,0xFFFF,0xFFFF,0xC000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0003,0xFFFF,0xFFFF,0xC000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0003,0xFFFF,0xFFFF,0xC000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0001,0xFFFF,0xFFFF,0x8000,0x0000,0xFFFF,0xFFFF,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
@//E*O*F Icons/queenStencil.icon//
chmod u=rw,g=r,o=r Icons/queenStencil.icon
 
echo x - Icons/rook.icon
sed 's/^@//' > "Icons/rook.icon" <<'@//E*O*F Icons/rook.icon//'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x001F,0xF800,0x0000,0x0000,0x003F,0xFC00,0x0000,
	0x0000,0x783F,0xFC1E,0x0000,0x0001,0xF83F,0xFC1F,0x8000,
	0x0003,0xF83F,0xFC1F,0xC000,0x0007,0xF83F,0xFC1F,0xE000,
	0x0007,0xF83F,0xFC1F,0xE000,0x0007,0xF83F,0xFC1F,0xE000,
	0x0007,0xF9FF,0xFF9F,0xE000,0x0007,0xFFFF,0xFFFF,0xE000,
	0x0007,0xFFFF,0xFFFF,0xE000,0x0007,0xFFFF,0xFFFF,0xE000,
	0x0007,0xFFFF,0xFFFF,0xE000,0x0007,0xFFFF,0xFFFF,0xE000,
	0x0001,0xFFFF,0xFFFF,0x8000,0x0000,0x7FFF,0xFFFE,0x0000,
	0x0000,0x1FFF,0xFFF8,0x0000,0x0000,0x0FFF,0xFFF0,0x0000,
	0x0000,0x0FFF,0xFFF0,0x0000,0x0000,0x0FFF,0xFFF0,0x0000,
	0x0000,0x0FFF,0xFFF0,0x0000,0x0000,0x0D5F,0xFFF0,0x0000,
	0x0000,0x0D5F,0xFFF0,0x0000,0x0000,0x0D5F,0xFFF0,0x0000,
	0x0000,0x0D5F,0xFFF0,0x0000,0x0000,0x0D5F,0xFFF0,0x0000,
	0x0000,0x0D5F,0xFFF0,0x0000,0x0000,0x0D5A,0xBFF0,0x0000,
	0x0000,0x0D5A,0xBFF0,0x0000,0x0000,0x0FFA,0xBFF0,0x0000,
	0x0000,0x0FFA,0xBFF0,0x0000,0x0000,0x0FFA,0xBFF0,0x0000,
	0x0000,0x0FFA,0xBFF0,0x0000,0x0000,0x0FFA,0xB570,0x0000,
	0x0000,0x0FFA,0xB570,0x0000,0x0000,0x0FFF,0xF570,0x0000,
	0x0000,0x0FFF,0xF570,0x0000,0x0000,0x0FFF,0xF570,0x0000,
	0x0000,0x0FFF,0xF570,0x0000,0x0000,0x0FFF,0xF570,0x0000,
	0x0000,0x0FFF,0xF570,0x0000,0x0000,0x0FFF,0xFFF0,0x0000,
	0x0000,0x0FFF,0xFFF0,0x0000,0x0000,0x0FFF,0xFFF0,0x0000,
	0x0000,0x0FFF,0xFFF0,0x0000,0x0000,0x1FFF,0xFFF8,0x0000,
	0x0000,0x3FFF,0xFFFC,0x0000,0x0000,0x7FFF,0xFFFE,0x0000,
	0x0000,0xFFFF,0xFFFF,0x0000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0001,0x8000,0x0001,0x8000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0001,0xFFFF,0xFFFF,0x8000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0001,0x8000,0x0001,0x8000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0000,0xFFFF,0xFFFF,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
@//E*O*F Icons/rook.icon//
chmod u=rw,g=r,o=r Icons/rook.icon
 
echo x - Icons/rookStencil.icon
sed 's/^@//' > "Icons/rookStencil.icon" <<'@//E*O*F Icons/rookStencil.icon//'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x001F,0xF800,0x0000,
	0x0000,0x003F,0xFC00,0x0000,0x0000,0x787F,0xFE1E,0x0000,
	0x0001,0xFC7F,0xFE3F,0x8000,0x0003,0xFC7F,0xFE3F,0xC000,
	0x0007,0xFC7F,0xFE3F,0xE000,0x000F,0xFC7F,0xFE3F,0xF000,
	0x000F,0xFC7F,0xFE3F,0xF000,0x000F,0xFDFF,0xFFBF,0xF000,
	0x000F,0xFFFF,0xFFFF,0xF000,0x000F,0xFFFF,0xFFFF,0xF000,
	0x000F,0xFFFF,0xFFFF,0xF000,0x000F,0xFFFF,0xFFFF,0xF000,
	0x000F,0xFFFF,0xFFFF,0xF000,0x000F,0xFFFF,0xFFFF,0xF000,
	0x0007,0xFFFF,0xFFFF,0xE000,0x0001,0xFFFF,0xFFFF,0x8000,
	0x0000,0x7FFF,0xFFFE,0x0000,0x0000,0x1FFF,0xFFF8,0x0000,
	0x0000,0x1FFF,0xFFF8,0x0000,0x0000,0x1FFF,0xFFF8,0x0000,
	0x0000,0x1FFF,0xFFF8,0x0000,0x0000,0x1FFF,0xFFF8,0x0000,
	0x0000,0x1FFF,0xFFF8,0x0000,0x0000,0x1FFF,0xFFF8,0x0000,
	0x0000,0x1FFF,0xFFF8,0x0000,0x0000,0x1FFF,0xFFF8,0x0000,
	0x0000,0x1FFF,0xFFF8,0x0000,0x0000,0x1FFF,0xFFF8,0x0000,
	0x0000,0x1FFF,0xFFF8,0x0000,0x0000,0x1FFF,0xFFF8,0x0000,
	0x0000,0x1FFF,0xFFF8,0x0000,0x0000,0x1FFF,0xFFF8,0x0000,
	0x0000,0x1FFF,0xFFF8,0x0000,0x0000,0x1FFF,0xFFF8,0x0000,
	0x0000,0x1FFF,0xFFF8,0x0000,0x0000,0x1FFF,0xFFF8,0x0000,
	0x0000,0x1FFF,0xFFF8,0x0000,0x0000,0x1FFF,0xFFF8,0x0000,
	0x0000,0x1FFF,0xFFF8,0x0000,0x0000,0x1FFF,0xFFF8,0x0000,
	0x0000,0x1FFF,0xFFF8,0x0000,0x0000,0x1FFF,0xFFF8,0x0000,
	0x0000,0x1FFF,0xFFF8,0x0000,0x0000,0x1FFF,0xFFF8,0x0000,
	0x0000,0x1FFF,0xFFF8,0x0000,0x0000,0x3FFF,0xFFFC,0x0000,
	0x0000,0x7FFF,0xFFFE,0x0000,0x0000,0xFFFF,0xFFFF,0x0000,
	0x0001,0xFFFF,0xFFFF,0x8000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0003,0xFFFF,0xFFFF,0xC000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0003,0xFFFF,0xFFFF,0xC000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0003,0xFFFF,0xFFFF,0xC000,0x0003,0xFFFF,0xFFFF,0xC000,
	0x0001,0xFFFF,0xFFFF,0x8000,0x0000,0xFFFF,0xFFFF,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
@//E*O*F Icons/rookStencil.icon//
chmod u=rw,g=r,o=r Icons/rookStencil.icon
 
echo x - Icons/blackSquare.icon
sed 's/^@//' > "Icons/blackSquare.icon" <<'@//E*O*F Icons/blackSquare.icon//'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xA222,0x2222,0x2222,0x2223,
	0xC444,0x4444,0x4444,0x4445,0x9111,0x1111,0x1111,0x1111,
	0x8888,0x8888,0x8888,0x8889,0xA222,0x2222,0x2222,0x2223,
	0xC444,0x4444,0x4444,0x4445,0x9111,0x1111,0x1111,0x1111,
	0x8888,0x8888,0x8888,0x8889,0xA222,0x2222,0x2222,0x2223,
	0xC444,0x4444,0x4444,0x4445,0x9111,0x1111,0x1111,0x1111,
	0x8888,0x8888,0x8888,0x8889,0xA222,0x2222,0x2222,0x2223,
	0xC444,0x4444,0x4444,0x4445,0x9111,0x1111,0x1111,0x1111,
	0x8888,0x8888,0x8888,0x8889,0xA222,0x2222,0x2222,0x2223,
	0xC444,0x4444,0x4444,0x4445,0x9111,0x1111,0x1111,0x1111,
	0x8888,0x8888,0x8888,0x8889,0xA222,0x2222,0x2222,0x2223,
	0xC444,0x4444,0x4444,0x4445,0x9111,0x1111,0x1111,0x1111,
	0x8888,0x8888,0x8888,0x8889,0xA222,0x2222,0x2222,0x2223,
	0xC444,0x4444,0x4444,0x4445,0x9111,0x1111,0x1111,0x1111,
	0x8888,0x8888,0x8888,0x8889,0xA222,0x2222,0x2222,0x2223,
	0xC444,0x4444,0x4444,0x4445,0x9111,0x1111,0x1111,0x1111,
	0x8888,0x8888,0x8888,0x8889,0xA222,0x2222,0x2222,0x2223,
	0xC444,0x4444,0x4444,0x4445,0x9111,0x1111,0x1111,0x1111,
	0x8888,0x8888,0x8888,0x8889,0xA222,0x2222,0x2222,0x2223,
	0xC444,0x4444,0x4444,0x4445,0x9111,0x1111,0x1111,0x1111,
	0x8888,0x8888,0x8888,0x8889,0xA222,0x2222,0x2222,0x2223,
	0xC444,0x4444,0x4444,0x4445,0x9111,0x1111,0x1111,0x1111,
	0x8888,0x8888,0x8888,0x8889,0xA222,0x2222,0x2222,0x2223,
	0xC444,0x4444,0x4444,0x4445,0x9111,0x1111,0x1111,0x1111,
	0x8888,0x8888,0x8888,0x8889,0xA222,0x2222,0x2222,0x2223,
	0xC444,0x4444,0x4444,0x4445,0x9111,0x1111,0x1111,0x1111,
	0x8888,0x8888,0x8888,0x8889,0xA222,0x2222,0x2222,0x2223,
	0xC444,0x4444,0x4444,0x4445,0x9111,0x1111,0x1111,0x1111,
	0x8888,0x8888,0x8888,0x8889,0xA222,0x2222,0x2222,0x2223,
	0xC444,0x4444,0x4444,0x4445,0x9111,0x1111,0x1111,0x1111,
	0x8888,0x8888,0x8888,0x8889,0xA222,0x2222,0x2222,0x2223,
	0xC444,0x4444,0x4444,0x4445,0xFFFF,0xFFFF,0xFFFF,0xFFFF
@//E*O*F Icons/blackSquare.icon//
chmod u=rw,g=r,o=r Icons/blackSquare.icon
 
echo x - Icons/whiteSquare.icon
sed 's/^@//' > "Icons/whiteSquare.icon" <<'@//E*O*F Icons/whiteSquare.icon//'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	0x8000,0x0000,0x0000,0x0001,0xFFFF,0xFFFF,0xFFFF,0xFFFF
@//E*O*F Icons/whiteSquare.icon//
chmod u=rw,g=r,o=r Icons/whiteSquare.icon
 
echo x - Icons/nchess.icon
sed 's/^@//' > "Icons/nchess.icon" <<'@//E*O*F Icons/nchess.icon//'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
	0xC000,0x0000,0x0000,0x0003,0xC000,0x0000,0x0000,0x0003,
	0xC000,0x0000,0x0000,0x0003,0xC000,0x0000,0x0000,0x0003,
	0xC000,0x0000,0x0000,0x0003,0xC000,0x0000,0x0000,0x0003,
	0xC000,0x0000,0x0000,0x0003,0xC000,0x0000,0x0000,0x0003,
	0xC000,0x0000,0x0000,0x0003,0xC000,0x0000,0x0000,0x0003,
	0xC000,0x0000,0x0000,0x0003,0xC000,0x0000,0x0000,0x0003,
	0xC000,0x0000,0x0000,0x0003,0xC000,0x0000,0x0000,0x0003,
	0xC000,0x0000,0x0000,0x0003,0xC000,0x0000,0x0000,0x0003,
	0xC000,0x0000,0x0000,0x0003,0xC000,0x0000,0x0000,0x0003,
	0xC000,0x0000,0x0000,0x0003,0xC000,0x0000,0x0000,0x0003,
	0xC000,0x0003,0xF000,0x0003,0xC000,0x0073,0x5380,0x0003,
	0xC000,0x01F2,0xB3C0,0x0003,0xC000,0x01F3,0x5B40,0x0003,
	0xC000,0x017B,0xFA40,0x0003,0xC000,0x010E,0x0A40,0x0003,
	0xC000,0x008E,0x0C80,0x0003,0xC000,0x0066,0x0300,0x0003,
	0xC000,0x0010,0x0C00,0x0003,0xC000,0x0012,0xA400,0x0003,
	0xC000,0x0018,0x0400,0x0003,0xC000,0x0018,0x0400,0x0003,
	0xC000,0x0019,0x0400,0x0003,0xC000,0x0019,0x0400,0x0003,
	0xC000,0x0019,0x0400,0x0003,0xC000,0x0011,0x2400,0x0003,
	0xC000,0x0011,0x2400,0x0003,0xC000,0x0010,0x2400,0x0003,
	0xC000,0x0030,0x27FF,0xFFFF,0xC000,0x0070,0x27FF,0xFFFF,
	0xC000,0x00E0,0x0200,0x0247,0xC000,0x01C0,0x0180,0x0D13,
	0xC000,0x0740,0x0140,0x188B,0xC000,0x0D18,0x0C40,0x2223,
	0xC000,0x1903,0x5040,0x4447,0xC000,0x3100,0x0040,0x9113,
	0xC000,0xE100,0x0043,0x888B,0xC001,0x80C0,0x0186,0x2223,
	0xC003,0x0038,0x0E0C,0x4447,0xC006,0x0007,0xF011,0x1113,
	0xC00C,0x0000,0x0028,0x888B,0xC038,0x0000,0x0062,0x2223,
	0xC07F,0xFFFF,0xFFFF,0xFFFF,0xC0D1,0x1111,0x1200,0x0003,
	0xC188,0x8888,0x8400,0x0003,0xC322,0x2222,0x2800,0x0003,
	0xCE44,0x4444,0x5000,0x0003,0xD911,0x1111,0x6000,0x0003,
	0xF888,0x8888,0x8000,0x0003,0xE222,0x2223,0x0000,0x0003,
	0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF
@//E*O*F Icons/nchess.icon//
chmod u=rw,g=r,o=r Icons/nchess.icon
 
echo Inspecting for damage in transit...
temp=/tmp/shar$$; dtemp=/tmp/.shar$$
trap "rm -f $temp $dtemp; exit" 0 1 2 3 15
cat > $temp <<\!!!
      58     183    1533 Makefile
     434    2596   16236 nchess.6
      87     234    2150 decls.h
     140     526    3434 nchess.h
     162     551    4501 daemon.c
      80     183    1474 xdr.c
      34      39    1933 bishop.icon
      34      39    1933 bishopStencil.icon
      34      39    1933 king.icon
      34      39    1933 kingStencil.icon
      34      39    1933 knight.icon
      34      39    1933 knightStencil.icon
      34      39    1933 pawn.icon
      34      39    1933 pawnStencil.icon
      34      39    1933 queen.icon
      34      39    1933 queenStencil.icon
      34      39    1933 rook.icon
      34      39    1933 rookStencil.icon
      34      39    1933 blackSquare.icon
      34      39    1933 whiteSquare.icon
      34      39    1933 nchess.icon
    1471    4858   58323 total
!!!
wc  Makefile nchess.6 decls.h nchess.h daemon.c xdr.c Icons/bishop.icon Icons/bishopStencil.icon Icons/king.icon Icons/kingStencil.icon Icons/knight.icon Icons/knightStencil.icon Icons/pawn.icon Icons/pawnStencil.icon Icons/queen.icon Icons/queenStencil.icon Icons/rook.icon Icons/rookStencil.icon Icons/blackSquare.icon Icons/whiteSquare.icon Icons/nchess.icon | sed 's=[^ ]*/==' | diff -b $temp - >$dtemp
if [ -s $dtemp ]
then echo "Ouch [diff of wc output]:" ; cat $dtemp
else echo "No problems found."
fi
exit 0