[comp.sources.games] v01i062: kriegspiel - A Chess Variant, Part03/04

games-request@tekred.TEK.COM (06/29/87)

Submitted by: Steve Schoch <schoch@ames.arpa>
Comp.sources.games: Volume 1, Issue 62
Archive-name: kriegspiel/Part03



#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 3 (of 4)."
# Contents:  bishop.h check.c constants.h icon.h king.h king_mask.h
#   knight.h knight_mask.h legalmove.c list.c makemove.c mate.c
#   options.c output.c pawn.h pawn_mask.h piecemoves.c queen.h
#   queen_mask.h review.c rook.h rook_mask.h xmove.c xoutput.c
# Wrapped by billr@tekred on Fri Jun 26 18:21:16 1987
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f bishop.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"bishop.h\"
else
echo shar: Extracting \"bishop.h\" \(2321 characters\)
sed "s/^X//" >bishop.h <<'END_OF_bishop.h'
X#define bishop_width 64
X#define bishop_height 64
Xstatic short bishop_bits[] = {
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0xc000, 0x0003, 0x0000,
X   0x0000, 0x4000, 0x0002, 0x0000,
X   0x0000, 0x4000, 0x0002, 0x0000,
X   0x0000, 0x2000, 0x0004, 0x0000,
X   0x0000, 0x1000, 0x0008, 0x0000,
X   0x0000, 0x0800, 0x0010, 0x0000,
X   0x0000, 0x0400, 0x0028, 0x0000,
X   0x0000, 0x0200, 0x0044, 0x0000,
X   0x0000, 0x0100, 0x0082, 0x0000,
X   0x0000, 0x0100, 0x0081, 0x0000,
X   0x0000, 0x8100, 0x0080, 0x0000,
X   0x0000, 0x0100, 0x0080, 0x0000,
X   0x0000, 0x0100, 0x0080, 0x0000,
X   0x0000, 0x0200, 0x0040, 0x0000,
X   0x0000, 0x0400, 0x0020, 0x0000,
X   0x0000, 0x0800, 0x0010, 0x0000,
X   0x0000, 0x1000, 0x0008, 0x0000,
X   0x0000, 0x0800, 0x0010, 0x0000,
X   0x0000, 0x0800, 0x0010, 0x0000,
X   0x0000, 0x0800, 0x0010, 0x0000,
X   0x0000, 0x0400, 0x0020, 0x0000,
X   0x0000, 0x0400, 0x0020, 0x0000,
X   0x0000, 0x0400, 0x0020, 0x0000,
X   0x0000, 0x0200, 0x0040, 0x0000,
X   0x0000, 0x0200, 0x0040, 0x0000,
X   0x0000, 0x0200, 0x0040, 0x0000,
X   0x0000, 0x0100, 0x0080, 0x0000,
X   0x0000, 0x0100, 0x0080, 0x0000,
X   0x0000, 0x0100, 0x0080, 0x0000,
X   0x0000, 0x0080, 0x0100, 0x0000,
X   0x0000, 0x0080, 0x0100, 0x0000,
X   0x0000, 0x0080, 0x0100, 0x0000,
X   0x0000, 0x0040, 0x0200, 0x0000,
X   0x0000, 0x0040, 0x0200, 0x0000,
X   0x0000, 0x0040, 0x0200, 0x0000,
X   0x0000, 0x0020, 0x0400, 0x0000,
X   0x0000, 0x0020, 0x0400, 0x0000,
X   0x0000, 0x0020, 0x0400, 0x0000,
X   0x0000, 0x0010, 0x0800, 0x0000,
X   0x0000, 0x0010, 0x0800, 0x0000,
X   0x0000, 0x0010, 0x0800, 0x0000,
X   0x0000, 0x0008, 0x1000, 0x0000,
X   0x0000, 0x0008, 0x1000, 0x0000,
X   0x0000, 0x0010, 0x0800, 0x0000,
X   0x0000, 0x0010, 0x0800, 0x0000,
X   0x0000, 0x0020, 0x0400, 0x0000,
X   0x0000, 0x0020, 0x0400, 0x0000,
X   0x0000, 0x0040, 0x0200, 0x0000,
X   0x0000, 0x0040, 0x0200, 0x0000,
X   0x0000, 0x0080, 0x0100, 0x0000,
X   0x0000, 0x0100, 0x0080, 0x0000,
X   0x0000, 0x0100, 0x0080, 0x0000,
X   0x0000, 0x00c0, 0x0300, 0x0000,
X   0x0000, 0x0030, 0x0c00, 0x0000,
X   0x0000, 0x0008, 0x1000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0xfffe, 0x7fff, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000};
END_OF_bishop.h
if test 2321 -ne `wc -c <bishop.h`; then
    echo shar: \"bishop.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f check.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"check.c\"
else
echo shar: Extracting \"check.c\" \(1825 characters\)
sed "s/^X//" >check.c <<'END_OF_check.c'
X#ifndef lint
Xstatic char rcsid[] = "$Header: check.c,v 1.4 87/02/12 13:21:04 schoch Exp $";
X#endif
X
X/* check.c */
X#include "externs.h"
X
Xmoveintocheck (from, to)
X	int from, to;
X{
X	int victim, intocheck;
X	u_char color;
X	LIST check ();
X
X	color = whose [from];			/* make move on board */
X	victim = findvictim (from, to);
X	if (victim)
X		whose [victim] = EMPTY;
X	whose [to] = color;
X	whose [from] = EMPTY;
X	if (occupant [from] == KING)
X		kingloc [color] = to;
X	intocheck = (check (color) != NIL);	/* see if now in check */
X	if (occupant [from] == KING)		/* restore board position */
X		kingloc [color] = from;
X	whose [from] = color;
X	whose [to] = EMPTY;
X	if (victim)
X		whose [victim] = 1 - color;
X	return intocheck;
X}
X
XLIST
Xcheck (color)
Xu_char color;
X{
X	LIST l, checkdirs, lmember (), linsert ();
X	int direction, spot, dist, side;
X
X	checkdirs = NIL;
X	l = dirlist [QUEEN];
X	while (l != NIL) {
X		direction = l->i;
X		l = l->n;
X		spot = kingloc [color];
X		for (dist = 1; TRUE; dist++) {
X			spot += direction;
X			if (spot < 0 || spot > 99)
X				continue;
X			if ((whose [spot] == 1 - color)
X			&& (lmember (-direction, dirlist [occupant [spot]])
X			    && !(occupant [spot] == KING && dist > 1)))
X				checkdirs = linsert (checkdirs, direction);
X			if (whose [spot] != EMPTY)
X				break;
X		}
X	}
X	l = dirlist [KNIGHT];
X	while (l != NIL) {
X		direction = l->i;
X		l = l->n;
X		spot = kingloc [color] + direction;
X		if (spot < 0 || spot > 99)
X			continue;
X		if (whose [spot] == 1 - color && occupant [spot] == KNIGHT)
X			checkdirs = linsert (checkdirs, direction);
X	}
X	for (side = -1; side <= 1; side += 2) {
X		spot = kingloc [color] + pawndir [color] + side;
X		if (spot < 0 || spot > 99)
X			continue;
X		if (whose [spot] == 1 - color && occupant [spot] == PAWN)
X			checkdirs = linsert(checkdirs, pawndir [color] + side);
X	}
X
X	return checkdirs;
X}
END_OF_check.c
if test 1825 -ne `wc -c <check.c`; then
    echo shar: \"check.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f constants.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"constants.h\"
else
echo shar: Extracting \"constants.h\" \(1321 characters\)
sed "s/^X//" >constants.h <<'END_OF_constants.h'
X/*
X * $Header: constants.h,v 1.3 87/05/19 18:48:05 schoch Exp $
X */
X
X/* These next two constants are system dependent */
X
X/* file used for printing a file to the terminal (try /bin/pr) */
X#define		PRINT_FILE	"/usr/ucb/more"
X/* file where help will be kept */
X#define		HELP_FILE	"/usr/games/src/ks/help"
X
X#define		ILLEGAL_PIECE	-1
X#define		ILLEGAL		-1
X#define		NOWAY		-2
X#define		AMBIGUOUS	-3
X#define		NOMOREPAWNTRIES	-4
X
X#define		UNSET		2
X#define		RANDOM		3
X#define		NIL		0
X#define		MAXBUFF		100
X
X#define		WHITE		0
X#define		BLACK		1
X#define		EMPTY		2
X#define		OFFBOARD	3
X
X#define		PAWN		1
X#define		KING		2
X#define		KNIGHT		3
X#define		BISHOP		4
X#define		ROOK		5
X#define		QUEEN		6
X
X#ifdef XKS
X#define		MESSAGE		0
X#define		OPPONENT	0
X#define		CHECK		1
X#define		LEGAL		2
X#define		INPUT		2
X#define		CAPTURE		3
X#define		TOMOVE		4
X#define		PAWNTRIES	5
X#define		MYCOLOR		6
X#define		CLOCK		7
X#define		PROMPT		8
X#else
X#define		MESSAGE		0
X#define		CHECK		1
X#define		LEGAL		2
X#define		CAPTURE		3
X#define		TOMOVE		4
X#define		PAWNTRIES	5
X#define		MYCOLOR		6
X#define		CLOCK		7
X#define		PROMPT		8
X#define		INPUT		9
X#define		OPPONENT	10
X#endif
X
X#define		NOPTIONS	3
X#define		COLOR		0
X#define		ANNOUNCETAKES	1
X#define		ANNOUNCEPAWNS	2
X
X/* states */
X#define		PLAYING		0
X#define		OVER		1	/* game over */
X#define		REVIEW		2	/* doing review */
END_OF_constants.h
if test 1321 -ne `wc -c <constants.h`; then
    echo shar: \"constants.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f icon.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"icon.h\"
else
echo shar: Extracting \"icon.h\" \(2315 characters\)
sed "s/^X//" >icon.h <<'END_OF_icon.h'
X#define icon_width 64
X#define icon_height 64
Xstatic short icon_bits[] = {
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x2200, 0x0000, 0x0000, 0x0000,
X   0x1200, 0x0000, 0x0000, 0x0004,
X   0x0a00, 0x0010, 0x0400, 0x0004,
X   0x0600, 0x2103, 0x4066, 0x0004,
X   0x0a00, 0x5291, 0xa4a2, 0x0004,
X   0x1200, 0x5191, 0x6464, 0x0004,
X   0x2200, 0x6311, 0xc426, 0x0004,
X   0x0000, 0x2000, 0x0020, 0x0000,
X   0x0000, 0x1000, 0x0020, 0x0000,
X   0x0000, 0x0300, 0x0000, 0x0000,
X   0x0000, 0x0300, 0x0000, 0x0000,
X   0x0000, 0x0300, 0x0000, 0x0000,
X   0x0000, 0x0300, 0x0000, 0x0000,
X   0x0000, 0x3ff0, 0x0000, 0x0000,
X   0x0000, 0x3ff0, 0x0000, 0x0000,
X   0x0000, 0x0300, 0x0000, 0x0000,
X   0x0000, 0x0300, 0x0000, 0x0000,
X   0x8000, 0x0303, 0x0007, 0x0000,
X   0xe000, 0xe31f, 0x001f, 0x0000,
X   0xf800, 0xfb7f, 0x007f, 0x0000,
X   0xfc00, 0xffff, 0x00ff, 0x0000,
X   0xfe00, 0xffff, 0x01ff, 0x0000,
X   0xff00, 0xfcff, 0x03ff, 0x0000,
X   0xff00, 0xfcff, 0x03ff, 0x0000,
X   0xff80, 0xfcff, 0x07ff, 0x0000,
X   0xffc0, 0xfcff, 0x0fff, 0x0000,
X   0xffc0, 0xfcff, 0x0fff, 0x0000,
X   0xffc0, 0xfcff, 0x0fff, 0x0000,
X   0x7fc0, 0x7ff8, 0x0ff8, 0x0000,
X   0x7fc0, 0x3ff0, 0x0ff8, 0x0000,
X   0x3fc0, 0x3ff0, 0x1ff0, 0x0000,
X   0x1f80, 0x1fe0, 0x70e0, 0x0000,
X   0x1f80, 0x1fe0, 0xc030, 0x0000,
X   0x1f80, 0x1fe0, 0x8010, 0x0000,
X   0x1f00, 0x0fc0, 0x8018, 0x0001,
X   0x3f00, 0x0fc0, 0x0008, 0x0001,
X   0x3f00, 0x0fc0, 0x000c, 0x0003,
X   0x7e00, 0x0fc0, 0x000c, 0x0003,
X   0xfe00, 0xffff, 0x000f, 0x0001,
X   0xfc00, 0xffff, 0x801f, 0x0001,
X   0x0c00, 0x0000, 0x8010, 0x0000,
X   0x0c00, 0x0000, 0xc030, 0x0000,
X   0x0c00, 0x0303, 0x70e3, 0x0000,
X   0x0c00, 0x0303, 0x3fc3, 0x0000,
X   0x0c00, 0x0000, 0x2040, 0x0000,
X   0x0c00, 0x0000, 0x2040, 0x0000,
X   0xfc00, 0xffff, 0x607f, 0x0000,
X   0xfc00, 0xffff, 0x607f, 0x0000,
X   0x0000, 0x0000, 0x4020, 0x0000,
X   0x0000, 0x0000, 0x4020, 0x0000,
X   0x0000, 0x0000, 0xc030, 0x0000,
X   0x0000, 0x0000, 0x8010, 0x0000,
X   0x0000, 0x0000, 0x8010, 0x0000,
X   0x0000, 0x0000, 0x8010, 0x0000,
X   0x0000, 0x0000, 0x801c, 0x0003,
X   0x0000, 0x0000, 0x0007, 0x000e,
X   0x0000, 0xc000, 0x0001, 0x0038,
X   0x0000, 0x7000, 0x0000, 0x00e0,
X   0x0000, 0x1800, 0x0000, 0x0180,
X   0x0000, 0x1800, 0x0000, 0x0180,
X   0x0000, 0xf800, 0xffff, 0x01ff,
X   0x0000, 0xf800, 0xffff, 0x01ff,
X   0x0000, 0x0000, 0x0000, 0x0000};
END_OF_icon.h
if test 2315 -ne `wc -c <icon.h`; then
    echo shar: \"icon.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f king.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"king.h\"
else
echo shar: Extracting \"king.h\" \(2315 characters\)
sed "s/^X//" >king.h <<'END_OF_king.h'
X#define king_width 64
X#define king_height 64
Xstatic short king_bits[] = {
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0xe000, 0x0007, 0x0000,
X   0xf800, 0x2000, 0x0004, 0x001f,
X   0x0700, 0xa00f, 0xf005, 0x00e0,
X   0x00c0, 0xa0f0, 0x0f05, 0x0300,
X   0x0020, 0x2300, 0x00c4, 0x0400,
X   0x0010, 0xe400, 0x0027, 0x0800,
X   0x0008, 0x0800, 0x0010, 0x1000,
X   0x0008, 0x1000, 0x0008, 0x1000,
X   0x0004, 0x2000, 0x0004, 0x2000,
X   0xf004, 0x401f, 0xf802, 0x200f,
X   0x0804, 0x8020, 0x0401, 0x2010,
X   0x0404, 0x8040, 0x0201, 0x2020,
X   0x0204, 0x0040, 0x0200, 0x2040,
X   0x0204, 0x0080, 0x0100, 0x2040,
X   0x0204, 0xc100, 0x0083, 0x2040,
X   0x0404, 0x4100, 0x0082, 0x2020,
X   0x0408, 0x4100, 0x0082, 0x1020,
X   0x0408, 0x4100, 0x0082, 0x1020,
X   0x0808, 0x4100, 0x0082, 0x1010,
X   0x0808, 0x4100, 0x0082, 0x1010,
X   0x1010, 0x4100, 0x0082, 0x0808,
X   0x2010, 0xc100, 0x0083, 0x0804,
X   0x2010, 0x0100, 0x0080, 0x0804,
X   0x4020, 0x0100, 0x0080, 0x0402,
X   0x8020, 0x0100, 0x0080, 0x0401,
X   0x0040, 0x0101, 0x8080, 0x0200,
X   0x0040, 0x0002, 0x4000, 0x0200,
X   0x0080, 0x0004, 0x2000, 0x0100,
X   0x0080, 0x0008, 0x1000, 0x0100,
X   0x0100, 0x0010, 0x0800, 0x0080,
X   0x0100, 0x0020, 0x0400, 0x0080,
X   0x0200, 0x0040, 0x0200, 0x0040,
X   0x0200, 0x0080, 0x0100, 0x0040,
X   0x0400, 0x0100, 0x0080, 0x0020,
X   0x0800, 0x0100, 0x0080, 0x0010,
X   0x1000, 0x0200, 0x0040, 0x0008,
X   0x2000, 0xfe00, 0x007f, 0x0004,
X   0x2000, 0x01f8, 0x1f80, 0x0004,
X   0xa000, 0x0007, 0xe000, 0x0005,
X   0x6000, 0x0000, 0x0000, 0x0006,
X   0x2000, 0x0000, 0x0000, 0x0004,
X   0x2000, 0x0000, 0x0000, 0x0004,
X   0x2000, 0x0000, 0x0000, 0x0004,
X   0x2000, 0x0000, 0x0000, 0x0004,
X   0x2000, 0x0000, 0x0000, 0x0004,
X   0x2000, 0x0000, 0x0000, 0x0004,
X   0x2000, 0x0000, 0x0000, 0x0004,
X   0x2000, 0x0000, 0x0000, 0x0004,
X   0x2000, 0x0000, 0x0000, 0x0004,
X   0x2000, 0x0000, 0x0000, 0x0004,
X   0x2000, 0xfe00, 0x007f, 0x0004,
X   0x2000, 0x01f8, 0x1f80, 0x0004,
X   0xa000, 0x0007, 0xe000, 0x0005,
X   0x6000, 0x0000, 0x0000, 0x0006,
X   0x4000, 0x0000, 0x0000, 0x0002,
X   0x8000, 0x0007, 0xe000, 0x0001,
X   0x0000, 0x01f8, 0x1f80, 0x0000,
X   0x0000, 0xfe00, 0x007f, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000};
END_OF_king.h
if test 2315 -ne `wc -c <king.h`; then
    echo shar: \"king.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f king_mask.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"king_mask.h\"
else
echo shar: Extracting \"king_mask.h\" \(2330 characters\)
sed "s/^X//" >king_mask.h <<'END_OF_king_mask.h'
X#define king_mask_width 64
X#define king_mask_height 64
Xstatic short king_mask_bits[] = {
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0xe000, 0x0007, 0x0000,
X   0xf800, 0xe000, 0x0007, 0x001f,
X   0xff00, 0xe00f, 0xf007, 0x00ff,
X   0xffc0, 0xe0ff, 0xff07, 0x03ff,
X   0xffe0, 0xe3ff, 0xffc7, 0x07ff,
X   0xfff0, 0xe7ff, 0xffe7, 0x0fff,
X   0xfff8, 0x0fff, 0xfff0, 0x1fff,
X   0xfff8, 0x1fff, 0xfff8, 0x1fff,
X   0xfffc, 0x3fff, 0xfffc, 0x3fff,
X   0xfffc, 0x7fff, 0xfffe, 0x3fff,
X   0xfffc, 0xffff, 0xffff, 0x3fff,
X   0xfffc, 0xffff, 0xffff, 0x3fff,
X   0xfffc, 0xffff, 0xffff, 0x3fff,
X   0xfffc, 0xffff, 0xffff, 0x3fff,
X   0xfffc, 0xffff, 0xffff, 0x3fff,
X   0xfffc, 0xffff, 0xffff, 0x3fff,
X   0xfff8, 0xffff, 0xffff, 0x1fff,
X   0xfff8, 0xffff, 0xffff, 0x1fff,
X   0xfff8, 0xffff, 0xffff, 0x1fff,
X   0xfff8, 0xffff, 0xffff, 0x1fff,
X   0xfff0, 0xffff, 0xffff, 0x0fff,
X   0xfff0, 0xffff, 0xffff, 0x0fff,
X   0xfff0, 0xffff, 0xffff, 0x0fff,
X   0xffe0, 0xffff, 0xffff, 0x07ff,
X   0xffe0, 0xffff, 0xffff, 0x07ff,
X   0xffc0, 0xffff, 0xffff, 0x03ff,
X   0xffc0, 0xffff, 0xffff, 0x03ff,
X   0xff80, 0xffff, 0xffff, 0x01ff,
X   0xff80, 0xffff, 0xffff, 0x01ff,
X   0xff00, 0xffff, 0xffff, 0x00ff,
X   0xff00, 0xffff, 0xffff, 0x00ff,
X   0xfe00, 0xffff, 0xffff, 0x007f,
X   0xfe00, 0xffff, 0xffff, 0x007f,
X   0xfc00, 0xffff, 0xffff, 0x003f,
X   0xf800, 0xffff, 0xffff, 0x001f,
X   0xf000, 0xffff, 0xffff, 0x000f,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xc000, 0xffff, 0xffff, 0x0003,
X   0x8000, 0xffff, 0xffff, 0x0001,
X   0x0000, 0xfff8, 0x1fff, 0x0000,
X   0x0000, 0xfe00, 0x007f, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000};
END_OF_king_mask.h
if test 2330 -ne `wc -c <king_mask.h`; then
    echo shar: \"king_mask.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f knight.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"knight.h\"
else
echo shar: Extracting \"knight.h\" \(2321 characters\)
sed "s/^X//" >knight.h <<'END_OF_knight.h'
X#define knight_width 64
X#define knight_height 64
Xstatic short knight_bits[] = {
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0208, 0x0000, 0x0000,
X   0x0000, 0x0518, 0x0000, 0x0000,
X   0x0000, 0x0528, 0x0000, 0x0000,
X   0x0000, 0x0548, 0x0000, 0x0000,
X   0x0000, 0x1d88, 0x0000, 0x0000,
X   0x0000, 0xf190, 0x0001, 0x0000,
X   0x0000, 0x3110, 0x003e, 0x0000,
X   0x0000, 0x0010, 0x03c0, 0x0000,
X   0x0000, 0x0010, 0x0e00, 0x0000,
X   0x0000, 0x0008, 0x3000, 0x0000,
X   0x0000, 0x0008, 0x4000, 0x0000,
X   0x0000, 0x0308, 0x8000, 0x0000,
X   0x0000, 0x0004, 0x0000, 0x0001,
X   0x0000, 0x0004, 0x0000, 0x0002,
X   0x0000, 0x0004, 0x0000, 0x0004,
X   0x0000, 0x0002, 0x0000, 0x0006,
X   0x0000, 0x0001, 0x0000, 0x000b,
X   0x8000, 0x0000, 0x0000, 0x0008,
X   0x4000, 0x0000, 0x0000, 0x0010,
X   0x2000, 0x0000, 0x0000, 0x0010,
X   0x1000, 0x0000, 0x0000, 0x0010,
X   0x0800, 0x0000, 0x0000, 0x0020,
X   0x0800, 0x0000, 0x0000, 0x0020,
X   0x0400, 0x0000, 0x0000, 0x0020,
X   0x0400, 0x0000, 0x0000, 0x0040,
X   0x0400, 0x0000, 0x0000, 0x0040,
X   0x0200, 0x0000, 0x0000, 0x0040,
X   0x0100, 0xfe00, 0x0000, 0x00c0,
X   0x0080, 0x0100, 0x0001, 0x0080,
X   0x00c0, 0x0080, 0x0002, 0x0080,
X   0x0040, 0x0040, 0x0004, 0x0080,
X   0x0040, 0x0020, 0x0004, 0x0080,
X   0x0040, 0x0010, 0x0004, 0x0080,
X   0x0080, 0x0008, 0x0004, 0x0080,
X   0x0100, 0x0004, 0x0004, 0x0100,
X   0x0100, 0x0002, 0x0004, 0x0200,
X   0x0100, 0x0001, 0x0002, 0x0200,
X   0x8200, 0x0000, 0x0001, 0x0200,
X   0x6200, 0x8000, 0x0000, 0x0200,
X   0x3c00, 0x4000, 0x0000, 0x0200,
X   0x0000, 0x2000, 0x0000, 0x0200,
X   0x0000, 0x1000, 0x0000, 0x0200,
X   0x0000, 0x0800, 0x0000, 0x0200,
X   0x0000, 0x0800, 0x0000, 0x0200,
X   0x0000, 0x0400, 0x0000, 0x0200,
X   0x0000, 0x0400, 0x0000, 0x0200,
X   0x0000, 0x0400, 0x0000, 0x0200,
X   0x0000, 0x0200, 0x0000, 0x0200,
X   0x0000, 0x0200, 0x0000, 0x0100,
X   0x0000, 0x0200, 0x0000, 0x0100,
X   0x0000, 0x0100, 0x0000, 0x0100,
X   0x0000, 0x0100, 0x0000, 0x0100,
X   0x0000, 0x0100, 0x0000, 0x0180,
X   0x0000, 0x0100, 0x0000, 0x0080,
X   0x0000, 0xff00, 0xffff, 0x00ff,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000};
END_OF_knight.h
if test 2321 -ne `wc -c <knight.h`; then
    echo shar: \"knight.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f knight_mask.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"knight_mask.h\"
else
echo shar: Extracting \"knight_mask.h\" \(2336 characters\)
sed "s/^X//" >knight_mask.h <<'END_OF_knight_mask.h'
X#define knight_mask_width 64
X#define knight_mask_height 64
Xstatic short knight_mask_bits[] = {
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0208, 0x0000, 0x0000,
X   0x0000, 0x0718, 0x0000, 0x0000,
X   0x0000, 0x0738, 0x0000, 0x0000,
X   0x0000, 0x0778, 0x0000, 0x0000,
X   0x0000, 0x1ff8, 0x0000, 0x0000,
X   0x0000, 0xfff0, 0x0001, 0x0000,
X   0x0000, 0xfff0, 0x003f, 0x0000,
X   0x0000, 0xfff0, 0x03ff, 0x0000,
X   0x0000, 0xfff0, 0x0fff, 0x0000,
X   0x0000, 0xfff8, 0x3fff, 0x0000,
X   0x0000, 0xfff8, 0x7fff, 0x0000,
X   0x0000, 0xfff8, 0xffff, 0x0000,
X   0x0000, 0xfffc, 0xffff, 0x0001,
X   0x0000, 0xfffc, 0xffff, 0x0003,
X   0x0000, 0xfffc, 0xffff, 0x0007,
X   0x0000, 0xfffe, 0xffff, 0x0007,
X   0x0000, 0xffff, 0xffff, 0x000f,
X   0x8000, 0xffff, 0xffff, 0x000f,
X   0xc000, 0xffff, 0xffff, 0x001f,
X   0xe000, 0xffff, 0xffff, 0x001f,
X   0xf000, 0xffff, 0xffff, 0x001f,
X   0xf800, 0xffff, 0xffff, 0x003f,
X   0xf800, 0xffff, 0xffff, 0x003f,
X   0xfc00, 0xffff, 0xffff, 0x003f,
X   0xfc00, 0xffff, 0xffff, 0x007f,
X   0xfc00, 0xffff, 0xffff, 0x007f,
X   0xfe00, 0xffff, 0xffff, 0x007f,
X   0xff00, 0xffff, 0xffff, 0x00ff,
X   0xff80, 0x01ff, 0xffff, 0x00ff,
X   0xffc0, 0x00ff, 0xfffe, 0x00ff,
X   0xffc0, 0x007f, 0xfffc, 0x00ff,
X   0xffc0, 0x003f, 0xfffc, 0x00ff,
X   0xffc0, 0x001f, 0xfffc, 0x00ff,
X   0xff80, 0x000f, 0xfffc, 0x00ff,
X   0xff00, 0x0007, 0xfffc, 0x01ff,
X   0xff00, 0x0003, 0xfffc, 0x03ff,
X   0xff00, 0x0001, 0xfffe, 0x03ff,
X   0xfe00, 0x0000, 0xffff, 0x03ff,
X   0x7e00, 0x8000, 0xffff, 0x03ff,
X   0x3c00, 0xc000, 0xffff, 0x03ff,
X   0x0000, 0xe000, 0xffff, 0x03ff,
X   0x0000, 0xf000, 0xffff, 0x03ff,
X   0x0000, 0xf800, 0xffff, 0x03ff,
X   0x0000, 0xf800, 0xffff, 0x03ff,
X   0x0000, 0xfc00, 0xffff, 0x03ff,
X   0x0000, 0xfc00, 0xffff, 0x03ff,
X   0x0000, 0xfc00, 0xffff, 0x03ff,
X   0x0000, 0xfe00, 0xffff, 0x03ff,
X   0x0000, 0xfe00, 0xffff, 0x01ff,
X   0x0000, 0xfe00, 0xffff, 0x01ff,
X   0x0000, 0xff00, 0xffff, 0x01ff,
X   0x0000, 0xff00, 0xffff, 0x01ff,
X   0x0000, 0xff00, 0xffff, 0x01ff,
X   0x0000, 0xff00, 0xffff, 0x00ff,
X   0x0000, 0xff00, 0xffff, 0x00ff,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000};
END_OF_knight_mask.h
if test 2336 -ne `wc -c <knight_mask.h`; then
    echo shar: \"knight_mask.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f legalmove.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"legalmove.c\"
else
echo shar: Extracting \"legalmove.c\" \(2197 characters\)
sed "s/^X//" >legalmove.c <<'END_OF_legalmove.c'
X#ifndef lint
Xstatic char rcsid[] = "$Header: legalmove.c,v 1.3 87/02/12 11:01:54 schoch Exp $";
X#endif
X
X/* legalmove.c */
X#include "externs.h"
X
Xlegalmove(pawntries, pawnattempts, checkdirs, from, to, color)
X	int from, to;
X	int pawntries, *pawnattempts;
X	LIST checkdirs;
X	u_char color;
X{
X	LIST lmember(), piecemoves();
X	int i;
X	static struct {
X		int from;
X		int to;
X	} pawnstried [3];
X
X	if (whose [from] != color)
X		return NOWAY;
X	else if (occupant [from] == KING && to == from + 2) {
X		if (!virgin [from]			/* castle king side */
X		|| !virgin [from + 3]
X		|| whose [from + 1] == color
X		|| whose [from + 2] == color)
X			return NOWAY;
X		else if (checkdirs
X		|| whose [from + 1] != EMPTY
X		|| whose [from + 2] != EMPTY
X		|| moveintocheck (from, from + 1)
X		|| moveintocheck (from, from + 2))
X			return ILLEGAL;
X		else
X			return TRUE;
X	} else if (occupant [from] == KING && to == from - 2) {
X		if (!virgin [from]			/* castle queen side */
X		|| !virgin [from - 4]
X		|| whose [from - 1] == color
X		|| whose [from - 2] == color
X		|| whose [from - 3] == color)
X			return NOWAY;
X		else if (checkdirs
X		|| whose [from - 1] != EMPTY
X		|| whose [from - 2] != EMPTY
X		|| whose [from - 3] != EMPTY
X		|| moveintocheck (from, from - 1)
X		|| moveintocheck (from, from - 2))
X			return ILLEGAL;
X		else
X			return TRUE;
X	} else if (!lmember (to, piecemoves (from, TRUE)))
X		return NOWAY;
X	else if (option [ANNOUNCEPAWNS] == TRUE
X	&& from % 10 != to % 10
X	&& occupant [from] == PAWN) {
X		if (pawntries == 0)
X			return NOWAY;
X		for (i = 0; i < *pawnattempts; i++)
X			if (pawnstried [i].from == from
X			&&  pawnstried [i].to   == to)
X				return ILLEGAL;
X		if (*pawnattempts == 3)
X			return NOMOREPAWNTRIES;
X		if (lmember(to, piecemoves(from, FALSE)) &&
X		    !moveintocheck(from, to))
X			return TRUE;
X		pawnstried [*pawnattempts].from = from;
X		pawnstried [(*pawnattempts)++].to = to;
X		if (*pawnattempts == 1)
X			message("1 attempt\n", MESSAGE);
X		else {
X			char buf[128];
X
X			sprintf(buf, "%d attempts\n", *pawnattempts);
X			message(buf, MESSAGE);
X		}
X		return ILLEGAL;
X	} else if (!lmember (to, piecemoves (from, FALSE)))
X		return ILLEGAL;
X	else if (moveintocheck (from, to))
X		return ILLEGAL;
X	else
X		return TRUE;
X}
END_OF_legalmove.c
if test 2197 -ne `wc -c <legalmove.c`; then
    echo shar: \"legalmove.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f list.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"list.c\"
else
echo shar: Extracting \"list.c\" \(800 characters\)
sed "s/^X//" >list.c <<'END_OF_list.c'
X#ifndef lint
Xstatic char rcsid[] = "$Header: list.c,v 1.3 87/02/12 11:02:40 schoch Exp $";
X#endif
X
X/* list.c */
X#include "constants.h"
X
X#ifndef FALSE
X#define FALSE	0
X#define TRUE	1
X#endif
X
Xstruct IN
X{
X	int i;
X	struct IN *n;
X};
Xtypedef struct IN *LIST;
X
XLIST
Xlinsert (list, number)
X	LIST list;
X	int number;
X{
X	LIST cell;
X
X	char *malloc ();
X	cell = (LIST) malloc (sizeof (struct IN));
X	cell->i = number;
X	cell->n = list;
X	return cell;
X}
X
XLIST
Xlmember (number, list)
X	int number;
X	LIST list;
X{
X	while (list != NIL) {
X		if (list->i == number)
X			return list;
X		list = list->n;
X	}
X	return FALSE;
X}
X
Xlfront (sublist, list)
X	LIST sublist, list; /* both must be non-NIL */
X	/* Allows easy deletion, when combined with lmember.  Violent. */
X{
X	int n;
X
X	n = list->i;
X	list->i  = sublist->i;
X	sublist->i = n;
X}
END_OF_list.c
if test 800 -ne `wc -c <list.c`; then
    echo shar: \"list.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f makemove.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"makemove.c\"
else
echo shar: Extracting \"makemove.c\" \(1772 characters\)
sed "s/^X//" >makemove.c <<'END_OF_makemove.c'
X#ifndef lint
Xstatic char rcsid[] = "$Header: makemove.c,v 1.1 87/02/12 11:03:53 schoch Exp $";
X#endif
X
X#include "externs.h"
X
Xmakemove (from, to, color)
X	int from, to, color;
X{
X	int victim;
X	LIST l, lmember ();
X	MOVELIST newmove;
X	static MOVELIST lastmove;
X	char *malloc ();
X
X	newmove = (MOVELIST) malloc (sizeof (struct MOVE));
X	newmove -> from = from;
X	newmove -> to = to;
X	newmove -> n = NULL;
X	if (!movelist)
X		movelist = newmove;
X	else
X		lastmove -> n = newmove;
X	lastmove = newmove;
X	victim = findvictim (from, to);
X	if (victim) {
X		if (option [ANNOUNCETAKES] || whose [victim] == ourcolor) {
X			char buf[128], *str;
X
X			if (occupant [victim] == PAWN)
X				str = "pawn";
X			else
X				str = "piece";
X			if (reverse)
X				sprintf(buf, "%s captured: %1c%1d\r",
X					 str, (9 - victim % 10) + 'a' - 1,
X					 victim / 10);
X			else
X				sprintf(buf, "%s captured: %1c%1d\r",
X					 str, victim % 10 + 'a' - 1,
X					 9 - victim / 10);
X			message(buf, CAPTURE);
X		}
X		if (whose[victim] == ourcolor) {
X			redraw_pos(victim);
X			display_capture(whose[victim], occupant[victim]);
X		}
X		virgin [victim] = FALSE;
X		whose [victim] = EMPTY;
X		lfront (lmember (victim, piecelocs [1 - color]),
X			piecelocs [1 - color]);
X		piecelocs [1 - color] = (piecelocs [1 - color])->n;
X	}
X	l = lmember (from, piecelocs [color]);
X	l->i = to;
X	if (occupant [from] == KING)
X		kingloc [color] = to;
X	virgin [from] = FALSE;
X	whose [to] = color;
X	occupant [to] = occupant [from];
X	whose [from] = EMPTY;
X	occupant [from] = 0;
X	if (occupant [to] == PAWN
X	&& ((to / 10 == 1 && color == WHITE)
X	||  (to / 10 == 8 && color == BLACK))) {
X		if (option [ANNOUNCETAKES])
X			message("pawn promoted\n", MESSAGE);
X		occupant [to] = QUEEN;
X	}
X	if (whose [to] == ourcolor) {
X		redraw_pos(from);
X		redraw_piece(to);
X	}
X}
END_OF_makemove.c
if test 1772 -ne `wc -c <makemove.c`; then
    echo shar: \"makemove.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f mate.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"mate.c\"
else
echo shar: Extracting \"mate.c\" \(940 characters\)
sed "s/^X//" >mate.c <<'END_OF_mate.c'
X#ifndef lint
Xstatic char rcsid[] = "$Header: mate.c,v 1.3 87/02/12 13:23:54 schoch Exp $";
X#endif
X
X/* mate.c */
X
X#include "externs.h"
X
Xmate (pawnattempts, color)
X	int pawnattempts;
Xu_char color;
X{
X	LIST l, tos, piecemoves ();
X	int from, to;
X
X	l = piecelocs [color];
X	while (l != NIL) {
X		from = l->i;
X		l = l->n;
X		tos = piecemoves (from, FALSE);
X		while (tos != NIL) {
X			to = tos->i;
X			tos = tos->n;
X			if (moveintocheck (from, to))
X				continue;
X			if (occupant [from] == PAWN
X			&& from % 10 != to % 10
X			&& pawnattempts > 3
X			&& option [ANNOUNCEPAWNS] == TRUE)
X				continue;
X			return FALSE;
X		}
X	}
X	return TRUE;
X}
X
Xinsufficient ()
X{
X	int i, p, minorpieces = 0;
X	LIST l;
X
X	for (i = 0; i < 2; i++) {
X		l = piecelocs [i];
X		while (l != NIL) {
X			p = occupant [l->i];
X			if (p == QUEEN || p == ROOK || p == PAWN)
X				return FALSE;
X			if (p == KNIGHT || p == BISHOP)
X				minorpieces++;
X			l = l->n;
X		}
X	}
X	return (minorpieces <= 2);
X}
END_OF_mate.c
if test 940 -ne `wc -c <mate.c`; then
    echo shar: \"mate.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f options.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"options.c\"
else
echo shar: Extracting \"options.c\" \(1805 characters\)
sed "s/^X//" >options.c <<'END_OF_options.c'
X#ifndef lint
Xstatic char rcsid[] = "$Header: options.c,v 1.1 87/02/12 11:06:21 schoch Exp $";
X#endif
X
X#include "externs.h"
X#include <strings.h>
X
Xdooptions()
X{
X	register i;
X	char *cp;
X	char optbuf[128];
X	u_char nopts[NOPTIONS];
X
X	if (iamserver) {
X		if (fgets(optbuf, sizeof optbuf, inp) == NULL)
X			if (ferror(inp))
X				error ("recv in dooptions");
X		if (cp = index(optbuf, '\n'))
X		    *cp = '\0';
X		if (cp = index(optbuf, '\r'))
X		    *cp = '\0';
X		for (i = 0; optbuf[i]; i++)
X			if (optbuf[i] >= '0' && optbuf[i] <= '9')
X			    nopts[i] = optbuf[i] - '0';
X			else
X			    nopts[i] = UNSET;
X		while (i < NOPTIONS)
X		    nopts[i++] = UNSET;
X		for (i = 0; i < NOPTIONS; i++) {
X			if (option [i] == UNSET || nopts[i] == UNSET)
X			    nopts[i] = option [i] = option[i] + nopts[i] - UNSET;
X			if (option [i] == UNSET)
X				if (i == COLOR)
X					option [i] = nopts[i] = RANDOM;
X				else
X					option [i] = nopts[i] = TRUE;
X			else if (option [i] != nopts[i])
X				option [i] = nopts[i] = RANDOM;
X			if (option [i] == RANDOM)
X				option [i] = nopts[i] = random () & 01;
X		}
X		for (i = 0; i < NOPTIONS; i++)
X		    optbuf[i] = nopts[i] + '0';
X		optbuf[i] = '\0';
X		fprintf(out, "%s\r\n", optbuf);
X	} else {
X		for (i = 0; i < NOPTIONS; i++)
X			nopts[i] = option [i];
X		if (nopts[COLOR] == WHITE || nopts[COLOR] == BLACK)
X			nopts[COLOR] = ! option [COLOR];
X		for (i = 0; i < NOPTIONS; i++)
X		    optbuf[i] = nopts[i] + '0';
X		optbuf[i] = '\0';
X		fprintf(out, "%s\r\n", optbuf);
X		if (fgets(optbuf, sizeof optbuf, inp) == NULL)
X			if (errno != EINTR)
X				error ("recv in dooptions");
X		if (cp = index(optbuf, '\n'))
X		    *cp = '\0';
X		if (cp = index(optbuf, '\r'))
X		    *cp = '\0';
X		for (i = 0; optbuf[i]; i++)
X			option[i] = optbuf[i] - '0';
X		option [COLOR] = !(optbuf[COLOR]-'0');
X	}
X	ourcolor = option [COLOR];
X}
END_OF_options.c
if test 1805 -ne `wc -c <options.c`; then
    echo shar: \"options.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f output.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"output.c\"
else
echo shar: Extracting \"output.c\" \(2033 characters\)
sed "s/^X//" >output.c <<'END_OF_output.c'
X#ifndef lint
Xstatic char rcsid[] = "$Header: output.c,v 1.1 87/02/12 11:07:18 schoch Exp $";
X#endif
X
X#include "externs.h"
X#include <strings.h>
X
Xredraw ()
X{
X	int i;
X
X	if (vtterm) {
X		/* make characters double-width on a vt100 type terminal */
X		overwrite (stdscr, backupscreen);
X		overwrite (blankscreen, stdscr);
X		refresh ();
X		printf("\0337\033[0;0H\033#6"); /* save cursor, home,
X						   and widen first line */
X		for (i = 1; i <= LINES - 1; i++)
X			printf("\n\033#6");	/* wide next line */
X		printf("\0338");		/* restore cursor */
X		overwrite (backupscreen, stdscr);
X		refresh();
X	} else
X		wrefresh(curscr);
X}
X
Xreportchecks (checkdirs, kingloc)
X	LIST checkdirs;
X	int kingloc;
X{
X	LIST l, lmember ();
X	int quadrant, n;
X	char str [2] [40];
X
X	n = 0;
X	quadrant = ((kingloc % 10 > 4) == (kingloc/10 < 5));
X	if (lmember (-9, checkdirs) || lmember (9, checkdirs))
X		if (quadrant == 1)
X			strcpy (str[n++], "long diagonal\n");
X		else
X			strcpy (str[n++], "short diagonal\n");
X	if (lmember (-11, checkdirs) || lmember (11, checkdirs))
X		if (quadrant == 0)
X			strcpy (str[n++], "long diagonal\n");
X		else
X			strcpy (str[n++], "short diagonal\n");
X	if (lmember (-10, checkdirs) || lmember (10, checkdirs))
X		strcpy (str[n++], "file\n");
X	if (lmember (-1, checkdirs) || lmember (1, checkdirs))
X		strcpy (str[n++], "rank\n");
X	l = dirlist [KNIGHT];
X	while (l != NIL) {
X		if (lmember (l->i, checkdirs))
X			strcpy (str[n++], "knight\n");
X		l = l->n;
X	}
X	if (n > 0) {
X		waddstr (win [CHECK], "check by the\n");
X		waddstr (win [CHECK], str[0]);
X	}
X	if (n == 2) {
X		waddstr (win [CHECK], "and ");
X		waddstr (win [CHECK], str[1]);
X	}
X	refresh();
X}
X
Xillegal (why, color)
X	int color, why;
X{
X	wclear (win [LEGAL]);
X	if (why == ILLEGAL)
X		waddstr (win [LEGAL], "illegal");
X	else if (color == ourcolor) {
X		if (why == NOMOREPAWNTRIES)
X		    waddstr (win [LEGAL], "3 pawns tried");
X		else if (why == NOWAY)
X			waddstr (win [LEGAL], "no way");
X		else if (why == AMBIGUOUS)
X			waddstr (win [LEGAL], "ambiguous");
X	} else
X		waddstr (win [LEGAL], "nope");
X}
END_OF_output.c
if test 2033 -ne `wc -c <output.c`; then
    echo shar: \"output.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f pawn.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"pawn.h\"
else
echo shar: Extracting \"pawn.h\" \(2315 characters\)
sed "s/^X//" >pawn.h <<'END_OF_pawn.h'
X#define pawn_width 64
X#define pawn_height 64
Xstatic short pawn_bits[] = {
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x8000, 0x0001, 0x0000,
X   0x0000, 0x4000, 0x0002, 0x0000,
X   0x0000, 0x2000, 0x0004, 0x0000,
X   0x0000, 0x1000, 0x0008, 0x0000,
X   0x0000, 0x1000, 0x0008, 0x0000,
X   0x0000, 0x1000, 0x0008, 0x0000,
X   0x0000, 0x1000, 0x0008, 0x0000,
X   0x0000, 0x2000, 0x0004, 0x0000,
X   0x0000, 0xd800, 0x001b, 0x0000,
X   0x0000, 0x0600, 0x0060, 0x0000,
X   0x0000, 0x0100, 0x0080, 0x0000,
X   0x0000, 0xff80, 0x01ff, 0x0000,
X   0x0000, 0x0800, 0x0010, 0x0000,
X   0x0000, 0x0800, 0x0010, 0x0000,
X   0x0000, 0x0800, 0x0010, 0x0000,
X   0x0000, 0x0800, 0x0010, 0x0000,
X   0x0000, 0x0400, 0x0020, 0x0000,
X   0x0000, 0x0400, 0x0020, 0x0000,
X   0x0000, 0x0400, 0x0020, 0x0000,
X   0x0000, 0x0400, 0x0020, 0x0000,
X   0x0000, 0x0200, 0x0040, 0x0000,
X   0x0000, 0x0200, 0x0040, 0x0000,
X   0x0000, 0x0200, 0x0040, 0x0000,
X   0x0000, 0x0200, 0x0040, 0x0000,
X   0x0000, 0x0200, 0x0040, 0x0000,
X   0x0000, 0x0200, 0x0040, 0x0000,
X   0x0000, 0x0200, 0x0040, 0x0000,
X   0x0000, 0x0400, 0x0020, 0x0000,
X   0x0000, 0x0400, 0x0020, 0x0000,
X   0x0000, 0x0400, 0x0020, 0x0000,
X   0x0000, 0x0800, 0x0010, 0x0000,
X   0x0000, 0x0800, 0x0010, 0x0000,
X   0x0000, 0x0800, 0x0010, 0x0000,
X   0x0000, 0x0800, 0x0010, 0x0000,
X   0x0000, 0x0800, 0x0010, 0x0000,
X   0x0000, 0x0600, 0x0060, 0x0000,
X   0x0000, 0x0180, 0x0180, 0x0000,
X   0x0000, 0x0060, 0x0600, 0x0000,
X   0x0000, 0x0018, 0x1800, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0002, 0x4000, 0x0000,
X   0x0000, 0xfffe, 0x7fff, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000};
END_OF_pawn.h
if test 2315 -ne `wc -c <pawn.h`; then
    echo shar: \"pawn.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f pawn_mask.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"pawn_mask.h\"
else
echo shar: Extracting \"pawn_mask.h\" \(2330 characters\)
sed "s/^X//" >pawn_mask.h <<'END_OF_pawn_mask.h'
X#define pawn_mask_width 64
X#define pawn_mask_height 64
Xstatic short pawn_mask_bits[] = {
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x8000, 0x0001, 0x0000,
X   0x0000, 0xc000, 0x0003, 0x0000,
X   0x0000, 0xe000, 0x0007, 0x0000,
X   0x0000, 0xf000, 0x000f, 0x0000,
X   0x0000, 0xf000, 0x000f, 0x0000,
X   0x0000, 0xf000, 0x000f, 0x0000,
X   0x0000, 0xf000, 0x000f, 0x0000,
X   0x0000, 0xe000, 0x0007, 0x0000,
X   0x0000, 0xf800, 0x001f, 0x0000,
X   0x0000, 0xfe00, 0x007f, 0x0000,
X   0x0000, 0xff00, 0x00ff, 0x0000,
X   0x0000, 0xff80, 0x01ff, 0x0000,
X   0x0000, 0xf800, 0x001f, 0x0000,
X   0x0000, 0xf800, 0x001f, 0x0000,
X   0x0000, 0xf800, 0x001f, 0x0000,
X   0x0000, 0xf800, 0x001f, 0x0000,
X   0x0000, 0xfc00, 0x003f, 0x0000,
X   0x0000, 0xfc00, 0x003f, 0x0000,
X   0x0000, 0xfc00, 0x003f, 0x0000,
X   0x0000, 0xfc00, 0x003f, 0x0000,
X   0x0000, 0xfe00, 0x007f, 0x0000,
X   0x0000, 0xfe00, 0x007f, 0x0000,
X   0x0000, 0xfe00, 0x007f, 0x0000,
X   0x0000, 0xfe00, 0x007f, 0x0000,
X   0x0000, 0xfe00, 0x007f, 0x0000,
X   0x0000, 0xfe00, 0x007f, 0x0000,
X   0x0000, 0xfe00, 0x007f, 0x0000,
X   0x0000, 0xfc00, 0x003f, 0x0000,
X   0x0000, 0xfc00, 0x003f, 0x0000,
X   0x0000, 0xfc00, 0x003f, 0x0000,
X   0x0000, 0xf800, 0x001f, 0x0000,
X   0x0000, 0xf800, 0x001f, 0x0000,
X   0x0000, 0xf800, 0x001f, 0x0000,
X   0x0000, 0xf800, 0x001f, 0x0000,
X   0x0000, 0xf800, 0x001f, 0x0000,
X   0x0000, 0xfe00, 0x007f, 0x0000,
X   0x0000, 0xff80, 0x01ff, 0x0000,
X   0x0000, 0xffe0, 0x07ff, 0x0000,
X   0x0000, 0xfff8, 0x1fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffe, 0x7fff, 0x0000,
X   0x0000, 0xfffe, 0x7fff, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000};
END_OF_pawn_mask.h
if test 2330 -ne `wc -c <pawn_mask.h`; then
    echo shar: \"pawn_mask.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f piecemoves.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"piecemoves.c\"
else
echo shar: Extracting \"piecemoves.c\" \(1590 characters\)
sed "s/^X//" >piecemoves.c <<'END_OF_piecemoves.c'
X#ifndef lint
Xstatic char rcsid[] = "$Header: piecemoves.c,v 1.1 87/02/12 11:08:18 schoch Exp $";
X#endif
X
X#include "externs.h"
X
XLIST
Xpiecemoves (from, ignoreenemy)
X	/* doesn't include castling */
X	int from, ignoreenemy;
X{
X	int piece, color, front, spot, side, addend, to;
X	LIST dirs, moves, linsert ();
X
X	piece = occupant [from];
X	color = whose [from];
X	moves = NIL;
X	if (piece == PAWN) {
X		front = from + pawndir [color];
X		if (whose [front] != color
X		&& (ignoreenemy || whose [front] == EMPTY)) {
X			moves = linsert (moves, front);
X			if (from / 10 == 7 - 5 * color) { /* pawn can move 2 */
X				spot = front + pawndir [color];
X				if (whose [spot] != color
X				&& (ignoreenemy || whose [spot] == EMPTY))
X					moves = linsert (moves, spot);
X			}
X		}
X		for (side = -1; side <= 1; side += 2) {
X			spot = front + side;
X			if (whose [spot] != color
X			&& whose [spot] != OFFBOARD
X			&& (ignoreenemy || whose [spot] == 1 - color
X			|| (from / 10 == 4 + color	/* en passent */
X			    && occupant [from + side] == PAWN
X			    && lastmovefrom == spot + pawndir [color]
X			    && lastmoveto == from + side)))
X				moves = linsert (moves, spot);
X		}
X	} else {
X		dirs = dirlist [piece];
X		while (dirs != NIL) {
X			addend = dirs->i;
X			dirs = dirs->n;
X			to = from;
X			while (TRUE) {
X				to += addend;
X				if (to < 0 || to > 99)
X					break;
X				if (whose [to] == OFFBOARD
X				||  whose [to] == color)
X					break;
X				moves = linsert (moves, to);
X				if (ignoreenemy == FALSE
X				&& whose [to] == 1 - color)
X					break;
X				if (piece == KING || piece == KNIGHT)
X					break;
X			}
X		}
X	}
X	return moves;
X}
END_OF_piecemoves.c
if test 1590 -ne `wc -c <piecemoves.c`; then
    echo shar: \"piecemoves.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f queen.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"queen.h\"
else
echo shar: Extracting \"queen.h\" \(2318 characters\)
sed "s/^X//" >queen.h <<'END_OF_queen.h'
X#define queen_width 64
X#define queen_height 64
Xstatic short queen_bits[] = {
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x00c0, 0x0300, 0x0000,
X   0x0000, 0x0120, 0x0480, 0x0000,
X   0x0000, 0x0120, 0x0480, 0x0000,
X   0x0000, 0x00c0, 0x0300, 0x0000,
X   0x0000, 0x00c0, 0x0300, 0x0000,
X   0x0000, 0x00a0, 0x0480, 0x0000,
X   0x0000, 0x0120, 0x0480, 0x0000,
X   0x0000, 0x0220, 0x0440, 0x0000,
X   0x0000, 0x0220, 0x0440, 0x0000,
X   0x0000, 0x0210, 0x0840, 0x0000,
X   0x0000, 0x0410, 0x0820, 0x0000,
X   0x0000, 0x0410, 0x0820, 0x0000,
X   0x0030, 0x0810, 0x0810, 0x0c00,
X   0x0048, 0x0810, 0x1010, 0x1200,
X   0x0048, 0x1008, 0x1008, 0x1200,
X   0x01f0, 0x1008, 0x1008, 0x0f80,
X   0x0280, 0x2008, 0x1004, 0x0140,
X   0x0500, 0x2008, 0x2004, 0x00a0,
X   0x0a00, 0x4004, 0x2002, 0x0050,
X   0x1400, 0x4004, 0x2002, 0x0028,
X   0x2400, 0x8004, 0x2001, 0x0024,
X   0x4800, 0x0004, 0x4000, 0x0012,
X   0x8800, 0x0002, 0x4000, 0x0011,
X   0x1000, 0x0003, 0xc000, 0x0008,
X   0x1000, 0x0002, 0x4000, 0x0008,
X   0x2000, 0x0000, 0x0000, 0x0004,
X   0x2000, 0x0000, 0x0000, 0x0004,
X   0x4000, 0x0000, 0x0000, 0x0002,
X   0x4000, 0x0000, 0x0000, 0x0002,
X   0x8000, 0x0000, 0x0000, 0x0001,
X   0x8000, 0xf000, 0x000f, 0x0001,
X   0x8000, 0x0f00, 0x00f0, 0x0001,
X   0x8000, 0x00e0, 0x0700, 0x0001,
X   0x8000, 0x0018, 0x1800, 0x0001,
X   0x8000, 0x0004, 0x2000, 0x0001,
X   0x8000, 0x0002, 0x4000, 0x0001,
X   0x0000, 0x0001, 0x8000, 0x0000,
X   0x0000, 0xe001, 0x8003, 0x0000,
X   0x0000, 0x00e1, 0x8780, 0x0000,
X   0x0000, 0x0011, 0x8800, 0x0000,
X   0x0000, 0x0009, 0x9000, 0x0000,
X   0x0000, 0x0006, 0x6000, 0x0000,
X   0x0000, 0x0002, 0x4000, 0x0000,
X   0x0000, 0xe002, 0x4007, 0x0000,
X   0x0000, 0x1f02, 0x40f8, 0x0000,
X   0x0000, 0x03fa, 0x5f00, 0x0000,
X   0x0000, 0x0006, 0x6000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x00f8, 0x1f00, 0x0000,
X   0x0000, 0x1f00, 0x00f8, 0x0000,
X   0x0000, 0xe000, 0x0007, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000};
END_OF_queen.h
if test 2318 -ne `wc -c <queen.h`; then
    echo shar: \"queen.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f queen_mask.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"queen_mask.h\"
else
echo shar: Extracting \"queen_mask.h\" \(2333 characters\)
sed "s/^X//" >queen_mask.h <<'END_OF_queen_mask.h'
X#define queen_mask_width 64
X#define queen_mask_height 64
Xstatic short queen_mask_bits[] = {
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x00c0, 0x0300, 0x0000,
X   0x0000, 0x01e0, 0x0780, 0x0000,
X   0x0000, 0x01e0, 0x0780, 0x0000,
X   0x0000, 0x00c0, 0x0300, 0x0000,
X   0x0000, 0x00c0, 0x0300, 0x0000,
X   0x0000, 0x00e0, 0x0780, 0x0000,
X   0x0000, 0x01e0, 0x0780, 0x0000,
X   0x0000, 0x03e0, 0x07c0, 0x0000,
X   0x0000, 0x03e0, 0x07c0, 0x0000,
X   0x0000, 0x03f0, 0x0fc0, 0x0000,
X   0x0000, 0x07f0, 0x0fe0, 0x0000,
X   0x0000, 0x07f0, 0x0fe0, 0x0000,
X   0x0030, 0x0ff0, 0x0ff0, 0x0c00,
X   0x0078, 0x0ff0, 0x1ff0, 0x1e00,
X   0x0078, 0x1ff8, 0x1ff8, 0x1e00,
X   0x01f0, 0x1ff8, 0x1ff8, 0x0f80,
X   0x0380, 0x3ff8, 0x1ffc, 0x01c0,
X   0x0700, 0x3ff8, 0x3ffc, 0x00e0,
X   0x0e00, 0xfffc, 0x3fff, 0x0070,
X   0x1c00, 0xfffc, 0x3fff, 0x0038,
X   0x3c00, 0xfffc, 0x3fff, 0x003c,
X   0x7800, 0xfffc, 0x7fff, 0x001e,
X   0xf800, 0xfffe, 0x7fff, 0x001f,
X   0xf000, 0xffff, 0xffff, 0x000f,
X   0xf000, 0xffff, 0xffff, 0x000f,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xc000, 0xffff, 0xffff, 0x0003,
X   0xc000, 0xffff, 0xffff, 0x0003,
X   0x8000, 0xffff, 0xffff, 0x0001,
X   0x8000, 0xffff, 0xffff, 0x0001,
X   0x8000, 0xffff, 0xffff, 0x0001,
X   0x8000, 0xffff, 0xffff, 0x0001,
X   0x8000, 0xffff, 0xffff, 0x0001,
X   0x8000, 0xffff, 0xffff, 0x0001,
X   0x8000, 0xffff, 0xffff, 0x0001,
X   0x0000, 0xffff, 0xffff, 0x0000,
X   0x0000, 0xffff, 0xffff, 0x0000,
X   0x0000, 0xffff, 0xffff, 0x0000,
X   0x0000, 0xffff, 0xffff, 0x0000,
X   0x0000, 0xffff, 0xffff, 0x0000,
X   0x0000, 0xfffe, 0x7fff, 0x0000,
X   0x0000, 0xfffe, 0x7fff, 0x0000,
X   0x0000, 0xfffe, 0x7fff, 0x0000,
X   0x0000, 0xfffe, 0x7fff, 0x0000,
X   0x0000, 0xfffe, 0x7fff, 0x0000,
X   0x0000, 0xfffe, 0x7fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfff8, 0x1fff, 0x0000,
X   0x0000, 0xff00, 0x00ff, 0x0000,
X   0x0000, 0xe000, 0x0007, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000};
END_OF_queen_mask.h
if test 2333 -ne `wc -c <queen_mask.h`; then
    echo shar: \"queen_mask.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f review.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"review.c\"
else
echo shar: Extracting \"review.c\" \(2169 characters\)
sed "s/^X//" >review.c <<'END_OF_review.c'
X#ifndef lint
Xstatic char rcsid[] = "$Header: review.c,v 1.4 87/05/19 18:45:56 schoch Exp $";
X#endif
X
X#include "externs.h"
X#include <sys/time.h>
X#define STEPTIME 3	/* time between moves in seconds */
X
X/*
X * Show a review of the game, with all pieces showing.  I assume this doesn't
X * get called when we're playing.
X */
Xreview ()
X{
X	int color = WHITE;
X	MOVELIST m;
X	auto int fds;
X	struct timeval tv;
X
X	if (state == REVIEW) {
X		message("Already showing review\n", MESSAGE);
X		return;
X	}
X	state = REVIEW;
X	initdirlists ();
X	initpiecelocs ();
X	initboard (TRUE);
X#ifndef XKS
X	touchwin (stdscr);
X#endif
X	redraw ();
X	m = movelist;
X	while (m) {
X		if (state != REVIEW)		/* somebody stopped us. */
X			return;
X#ifdef XKS
X		fds = 1 << dpyno();
X#else
X		fds = 1;	/* stdin */
X#endif
X		tv.tv_usec = 0;
X		tv.tv_sec = STEPTIME;
X		(void) select(32, &fds, 0, 0, &tv);
X#ifdef XKS
X		if (fds & (1<<dpyno())) {
X			handle_input();
X			if (state != REVIEW)
X				return;
X			while (XPending()) {
X				handle_input();
X					if (state != REVIEW)
X						return;
X			}
X			continue;
X		}
X#else
X		if (fds & 1) {
X			if (getchar() == '\f')	/* control-L */
X				redraw();
X			continue;
X		}
X#endif
X		if (occupant[m->from] == KING &&
X		    ((m->to - m->from) == 2 ||
X		    (m->from - m->to) == 2)) {	/* castling */
X			makereviewmove (m -> from, m -> to, color);
X			m = m->n;
X		}
X		makereviewmove (m -> from, m -> to, color);
X		refresh();
X		m = m -> n;
X		color = 1 - color;
X	}
X	state = OVER;
X}
X
Xmakereviewmove (from, to, color)
X	int from, to, color;
X{
X	int victim;
X	char buf[128];
X
X	mclear(INPUT);
X	if (victim = findvictim (from, to)) {
X		display_capture(whose[victim], occupant[victim]);
X		whose [victim] = EMPTY;
X		occupant[victim] = 0;
X		redraw_pos(victim);
X	}
X	whose [to] = color;
X	occupant [to] = occupant [from];
X	whose [from] = EMPTY;
X	occupant [from] = 0;
X	if (occupant [to] == PAWN
X	&& ((to / 10 == 1 && color == WHITE)
X	||  (to / 10 == 8 && color == BLACK)))
X		occupant [to] = QUEEN;
X	redraw_pos(from);
X	redraw_piece(to);
X	if (reverse) {
X		from = 99 - from;
X		to = 99 - to;
X	}
X	sprintf(buf, ": %1c%1d-%1c%1d", 'a' + (9-from%10)-1, (9-from/10),
X					'a' + (9 - to%10)-1, (9 - to/10));
X	message(buf, INPUT);
X}
END_OF_review.c
if test 2169 -ne `wc -c <review.c`; then
    echo shar: \"review.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f rook.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"rook.h\"
else
echo shar: Extracting \"rook.h\" \(2315 characters\)
sed "s/^X//" >rook.h <<'END_OF_rook.h'
X#define rook_width 64
X#define rook_height 64
Xstatic short rook_bits[] = {
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0xf800, 0xf003, 0xc03f, 0x001f,
X   0x0800, 0x1002, 0x4020, 0x0010,
X   0x0800, 0x1002, 0x4020, 0x0010,
X   0x0800, 0x1002, 0x4020, 0x0010,
X   0x0800, 0x1ffe, 0x7fe0, 0x0010,
X   0x1000, 0x0000, 0x0000, 0x0008,
X   0x2000, 0x0000, 0x0000, 0x0004,
X   0x4000, 0x0000, 0x0000, 0x0002,
X   0x8000, 0x0000, 0x0000, 0x0001,
X   0x0000, 0x0001, 0x8000, 0x0000,
X   0x0000, 0x0002, 0x4000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0x0004, 0x2000, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0x0002, 0x4000, 0x0000,
X   0x0000, 0x0001, 0x8000, 0x0000,
X   0x8000, 0x0000, 0x0000, 0x0001,
X   0x4000, 0x0000, 0x0000, 0x0002,
X   0x4000, 0x0000, 0x0000, 0x0002,
X   0x2000, 0x0000, 0x0000, 0x0004,
X   0x2000, 0x0000, 0x0000, 0x0004,
X   0x1000, 0x0000, 0x0000, 0x0008,
X   0x0800, 0x0000, 0x0000, 0x0010,
X   0xf800, 0xffff, 0xffff, 0x001f,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000};
END_OF_rook.h
if test 2315 -ne `wc -c <rook.h`; then
    echo shar: \"rook.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f rook_mask.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"rook_mask.h\"
else
echo shar: Extracting \"rook_mask.h\" \(2330 characters\)
sed "s/^X//" >rook_mask.h <<'END_OF_rook_mask.h'
X#define rook_mask_width 64
X#define rook_mask_height 64
Xstatic short rook_mask_bits[] = {
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0xf800, 0xf003, 0xc03f, 0x001f,
X   0xf800, 0xf003, 0xc03f, 0x001f,
X   0xf800, 0xf003, 0xc03f, 0x001f,
X   0xf800, 0xf003, 0xc03f, 0x001f,
X   0xf800, 0xffff, 0xffff, 0x001f,
X   0xf000, 0xffff, 0xffff, 0x000f,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xc000, 0xffff, 0xffff, 0x0003,
X   0x8000, 0xffff, 0xffff, 0x0001,
X   0x0000, 0xffff, 0xffff, 0x0000,
X   0x0000, 0xfffe, 0x7fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffc, 0x3fff, 0x0000,
X   0x0000, 0xfffe, 0x7fff, 0x0000,
X   0x0000, 0xffff, 0xffff, 0x0000,
X   0x8000, 0xffff, 0xffff, 0x0001,
X   0xc000, 0xffff, 0xffff, 0x0003,
X   0xc000, 0xffff, 0xffff, 0x0003,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xe000, 0xffff, 0xffff, 0x0007,
X   0xf000, 0xffff, 0xffff, 0x000f,
X   0xf800, 0xffff, 0xffff, 0x001f,
X   0xf800, 0xffff, 0xffff, 0x001f,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000,
X   0x0000, 0x0000, 0x0000, 0x0000};
END_OF_rook_mask.h
if test 2330 -ne `wc -c <rook_mask.h`; then
    echo shar: \"rook_mask.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f xmove.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"xmove.c\"
else
echo shar: Extracting \"xmove.c\" \(1061 characters\)
sed "s/^X//" >xmove.c <<'END_OF_xmove.c'
X#ifndef lint
Xstatic char rcsid[] = "$Header: xmove.c,v 1.5 87/03/31 17:41:49 schoch Exp $";
X#endif
X
X#include "externs.h"
X
Xdomove(from, to)
X{
X
X    if (whose[from] != ourcolor) {
X	fprintf(stderr, "Moving wrong piece: %d at %d\n", whose[from], from);
X	return;
X    }
X    if (inp == NULL) {
X	message("Sorry, lost your opponent.", MESSAGE);
X	return;
X    }
X    fprintf(out, "%1c%1d-%1c%1d\r\n", from%10-1+'a', 9-from/10,
X	to%10-1+'a', 9-to/10);
X    if (movetry(from, to, ourcolor))
X	return;
X    if (ghost[to]) {		/* "capture" a ghost */
X	ghost_capture(to);
X	ghost[to] = 0;
X    }
X}
X
Xghost_capture(p)
X{
X    display_capture(theircolor, ghost[p]);
X}
X
Xdisplay_capture(color, piece)
Xu_char color, piece;
X{
X    int i;
X    int n;
X
X    if (color == WHITE)
X	n = 0;
X    else
X	n = 16;
X    for (i = 0; i < 16; i+=2)
X	if (captured[n+i] == 0)
X	    break;
X    if (i >= 16)
X	for (i = 1; i < 16; i+=2)
X	    if (captured[n+i] == 0)
X		break;
X    if (i >= 16) {
X	fprintf(stderr, "panic: can't find capture space.\n");
X	exit(1);
X    }
X    captured[i+n] = piece;
X    redraw_captured(i+n);
X}
END_OF_xmove.c
if test 1061 -ne `wc -c <xmove.c`; then
    echo shar: \"xmove.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f xoutput.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"xoutput.c\"
else
echo shar: Extracting \"xoutput.c\" \(1555 characters\)
sed "s/^X//" >xoutput.c <<'END_OF_xoutput.c'
X#ifndef lint
Xstatic char rcsid[] = "$Header: xoutput.c,v 1.3 87/02/12 11:14:37 schoch Exp $";
X#endif
X
X/* output.c */
X#include "externs.h"
X#include <strings.h>
X
Xreportchecks (checkdirs, kingloc)
X	LIST checkdirs;
X	int kingloc;
X{
X	LIST l, lmember ();
X	int quadrant, n;
X	char str [2] [40];
X	char buf[128];
X
X	buf[0] = '\0';
X	n = 0;
X	quadrant = ((kingloc % 10 > 4) == (kingloc/10 < 5));
X	if (lmember (-9, checkdirs) || lmember (9, checkdirs))
X		if (quadrant == 1)
X			strcpy (str[n++], "long diagonal");
X		else
X			strcpy (str[n++], "short diagonal");
X	if (lmember (-11, checkdirs) || lmember (11, checkdirs))
X		if (quadrant == 0)
X			strcpy (str[n++], "long diagonal");
X		else
X			strcpy (str[n++], "short diagonal");
X	if (lmember (-10, checkdirs) || lmember (10, checkdirs))
X		strcpy (str[n++], "file\n");
X	if (lmember (-1, checkdirs) || lmember (1, checkdirs))
X		strcpy (str[n++], "rank\n");
X	l = dirlist [KNIGHT];
X	while (l != NIL) {
X		if (lmember (l->i, checkdirs))
X			strcpy (str[n++], "knight");
X		l = l->n;
X	}
X	if (n > 0) {
X		strcpy(buf, "check by the ");
X		strcat(buf, str[0]);
X	}
X	if (n == 2) {
X		strcat(buf, " and ");
X		strcat(buf, str[1]);
X	}
X	if (n > 0)
X		message(buf, CHECK);
X}
X
Xillegal (why, color)
X	int why;
X	u_char color;
X{
X	mclear(LEGAL);
X	if (why == ILLEGAL)
X		message("illegal", LEGAL);
X	else if (color == ourcolor) {
X		if (why == NOMOREPAWNTRIES) {
X		    mclear(PAWNTRIES);
X		    message("3 pawns tried", LEGAL);
X		} else if (why == NOWAY)
X			message("no way", LEGAL);
X		else
X			message("ambiguous", LEGAL);
X	} else
X		message("nope", LEGAL);
X}
END_OF_xoutput.c
if test 1555 -ne `wc -c <xoutput.c`; then
    echo shar: \"xoutput.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 3 \(of 4\).
cp /dev/null ark3isdone
MISSING=""
for I in 1 2 3 4 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 4 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0