Zippy README file
Last modified on Wed Feb 24 23:34:09 PST 1999 by mann
-----------------

Zippy is a program that lets GNU Chess act as a computer player on an
Internet Chess Server.  It also works with Crafty.  Zippy is
unsupported, experimental code.

Zippy is based on XBoard, a graphical interface to GNU Chess and to
the ICS for the X Window system on Unix.  Zippy consists of exactly
the same code as XBoard, plus one extra module that ties together the
otherwise-separate functions of talking to GNU Chess and talking to
the ICS.  Zippy is included in the XBoard distribution.

There is also a version of Zippy that is based on WinBoard, a port of
XBoard to Win32 (Microsoft Windows NT and Windows 95).  WinBoard does
*not* run on Windows 3.1 or 3.11, not even with Win32s.  In versions
3.5 and later, the Zippy code is included in WinBoard.exe.

If you use Zippy, I ask you to do the following:

- Don't expect fast response if you send me mail about problems.  It
might take weeks for me to get back to you, or I might answer right
away.  Try to solve problems yourself before you mail me about them.
Try asking someone who is actively running a Zippy-based player on ICC
or FICS for help getting started.  Mail me only if you get stuck.

- Be honest.  Tell the admins of whatever ICS you use that your player
is a computer, so that it gets put onto the computer list, and follow
the ICS computer policies.  On ICC these are in "help computer"; read
this file and abide by what it says.

- If you want to interface some other chess program to ICS, feel free
to start with this code.  Some documentation is in the file
engine-intf.txt in the distribution.

- Please do not use the -zt flag to have your program shout Zippy the
Pinhead sayings (or other things that my Zippy shouts).  One pinhead
per server is plenty, and I'd like to keep the franchise.  Feel free
to use -zt to have your program shout some other kind of sayings if
you like.  Some of the jokes that Zippy shouts on ICC came from
ftp://ftp.cco.caltech.edu/pub/humor.  The poetry came from Project
Gutenberg; try http://www.cs.cmu.edu/Web/booktitles.html as a starting
point.  You might find other suitable material at these sites.  Prose
tends to work poorly because it is dull when shouted in isolated
250-character chunks.

	--Tim Mann <mann@pa.dec.com>
	  http://www.research.digital.com/SRC/personal/Tim_Mann/chess.html

* * *

Unix: To build the Zippy version of xboard, on most systems just do: 
	configure --enable-zippy
	make

Windows: WinBoard.exe (versions 3.5 and later) includes the Zippy
code.  There is no longer a distinct WinZippy.exe.

In both xboard and WinBoard, the Zippy features are off by default.
You can activate them with two new resources/command line options, and
you can fine-tune them with some new environment variables, all
described below.

You will probably want to make a shell script or Windows .BAT file
that sets the environment variables you want to use and invokes Zippy
with the right command line options for your situation.  Some examples
are at the bottom of this file.

If you have problems building or running Zippy, see the rest of the
xboard documentation: INSTALL documents the configure program, while
READ_ME and xboard.man (or xboard.doc) document xboard itself, and
WinBoard.hlp documents WinBoard.  FAQ answers some frequently asked
questions.  The file engine-intf.txt contains some information about
the interface between xboard/WinBoard and GNU Chess (or other chess
engines).

NEW OPTIONS

  -zippyPlay or -zp
	If zippyPlay is set to True, when xboard is in -ics mode, it
	will interface gnuchess to the ICS instead of letting you
	play.  You must also set -ics when you use this mode.

	In zippyPlay mode, xboard blindly issues an accept command for
	every challenge it gets, without remembering anything about
	the challenge afterwards. This means that often it will get
	several challenges very close together and try to accept them
	all!  ICS gives an error message for every accept command
	after the one that actually starts a match, but xboard just
	happily ignores the message.  xboard doesn't actually start
	the chess engine playing until the first board image comes in
	from ICS.

	The getMoveList option controls how adjourned games are
	continued.  If it is True (the default), xboard fetches the
	move list from ICS and feeds it into the chess program before
	having the program start play.  If False, xboard feeds the
	current position into the chess program and has it start from
	there.  The latter option gets the program going sooner, but
	can cause problems with detection of en passant legality,
	castling legality (if a king or rook has moved and then
	returned to its home square), draw by repetition, and draw by
	the 50 move rule.

	In zippyPlay mode, colorization in the ICS interaction window,
	and the sounds corresponding to colors in that window, do not
	work.  ZIPPYPASSWORD and related features (see below) capture
	the tells, etc., before they can be matched by the color/sound
	code.

  -zippyTalk or -zt
	If -zippyTalk is set to True and xboard is in -ics mode:

	(1) It will reply to anything said to it with a saying (if
	there is a file of sayings in its working directory).  This
	includes channel tells and shouts where its name is mentioned.
	Some things it says to opponents in specific situations will
	also be made Zippy-ish; you might want to change that.  See
	ZIPPYLINES below for the file format.

	(2) If a player XXX in your notify list logs on, xboard sends
	the command "greet XXX" to ICS and tells XXX something from
	its sayings file.  You can alias this to whatever you like.
	If XXX is censoring you, he is automatically removed from your
	notify list.
	
	If -zt is on, colorization in the ICS interaction window, and
	the sounds corresponding to colors in that window, do not
	work.  The reply feature captures the tells, etc., before they
	can be matched by the color/sound code.

NEW ENVIRONMENT VARIABLES

  Warning: some of these environment variables have names that are too
  long for Solaris 2.5's /bin/csh.  Try tcsh instead.

  ZIPPYPINHEAD
	In -zippyTalk mode, if user XXX shouts anything containing
	this string, xboard sends the command "insult XXX" to ICS.
	You can alias "insult" to whatever you like.  This feature is
	disabled if the variable is not set.

  ZIPPYPASSWORD
	If someone does an ICS "tell" to xboard that begins with this
	password, it will type the same string back as a command with
	the password stripped off.  For example, if the password is
	!%%! and xboard sees the string "Darooha tells you: !%%!shout
	Hi there", it will type the command "shout Hi there" to the
	ICS.  This feature is disabled if the variable is not set.

  ZIPPYPASSWORD2
	If someone does an ICS "tell" to xboard that begins with this
	password, it will send the same string directly to gnuchess
	with the password stripped off.  This feature is disabled if
	the variable is not set.  Use with caution.

  ZIPPYWRONGPASSWORD
	This is a joke feature.  If player XXX does an ICS "tell" to
        xboard that begins with this password, it will send the
        command "wrong XXX" to ICS.  ICS does not define a "wrong"
        command, but you can alias it to whatever you like.  The
        feature is supposed to be used after you've changed the
        ZIPPYPASSWORD, so that people who knew the old password get a
        funny message.

  ZIPPYUSEI
	If this variable is 1, Zippy's shouts use the "I" command with
	funny verbs; otherwise they use the "shout" command.  Default
	is 1.  The variable is automatically set to 0 if the "I"
	command is disabled on ICS by the admins.

  ZIPPYLINES
	Name of the file Zippy looks in for sayings when -zt is set.
	Default: yow.lines.  File format: There must be a single null
	character (control-@, ASCII code \000) after each saying.
	Sayings can have newlines in them; Zippy will remove them.
	Sayings can be at most about 250 characters; longer ones will
	be ignored.  The first saying in the file is never used; you
	should put a comment there.  If you have only one or two
	sayings in your file, Zippy may get into a loop trying to
	choose one.  Zippy chooses a saying by seeking to a random
	character position in the file, skipping ahead to the *next*
	null character, and printing the saying that starts there.  If
	it hits end of file without finding a new saying, it tries
	again.  Yes, this is a dumb algorithm.

	It can be somewhat hard to get a null character into your
	files, especially if you are using Windows.  Neither Notepad,
	Write, Word, nor vi can deal with null characters in a file.
	I recommend using GNU Emacs as your text editor.  It lets you
	insert a null by typing Ctrl-Q Ctrl-@.  See
	http://www.cs.washington.edu/homes/voelker/ntemacs.html to get
	GNU Emacs for Windows.  The GNU Emacs distribution also
	includes the original yow.lines file of Zippy sayings, in the
	etc subdirectory.  You can use this for testing, but as noted
	above, please find something else for your program to say on
	the chess servers once you get -zt mode working.

  ZIPPYACCEPTONLY
	If this variable is set to an ICS login name, Zippy will
        accept challenges only from that person.  Also suppresses the
        ZIPPYGAMEEND feature described below.  Useful for testing.

  ZIPPYNOPLAYCRAFTY
	If this variable is set to 1, if Zippy's opponent kibitzes
	"Hello from Crafty" within the first couple of moves, Zippy
	will abort the game and add the opponent to his noplay list.

  ZIPPYGAMESTART
	At the start of each game Zippy plays (including resuming from
	adjournment), it sends this string to ICS, followed by a newline.
	If the variable is not set, nothing is sent.

  ZIPPYGAMEEND
	At the end of each game, Zippy sends this string to ICS,
        followed by a newline.  The default is "gameend", so you can
        customize the behavior either by changing this environment
        variable or aliasing the "gameend" command on ICS.  Note that
        the default "gameend" command will give you a harmless ICS
        error message if you don't change it or alias it.

  ZIPPYADJOURN
	Zippy will allow its opponent to adjourn if this variable is
	set to 1.

  ZIPPYABORT
	Zippy will allow its opponent to abort if this variable is
	set to 1.

  ZIPPYVARIANTS
	Zippy will decline to play chess variants unless their names
	(as given in engine-intf.txt) are listed in this variable.
	Default: "normal".  Example: "suicide,losers,bughouse,normal".

	Obviously, ZIPPYVARIANTS other than "normal" will work only if
	your chess engine can play those variants.  GNU Chess
	certainly cannot, but there are some suicide and bughouse
	engines available.  While playing bughouse, Zippy passes
	certain extra information on to the engine; see
	engine-intf.txt.

  ZIPPYBUGHOUSE
        This variable controls how Zippy handles bughouse partner
        requests.  If ZIPPYBUGHOUSE is set to 0, Zippy will decline
        any offers of partnership and tell the offerer that it cannot
        play bughouse.  If ZIPPYBUGHOUSE is set to 1, Zippy will
        decline offers, but you can make Zippy your partner by having
        *it* offer *you* partnership (by using ZIPPYPASSWORD or typing
        directly into its window).  If ZIPPYBUGHOUSE is set to 2,
        Zippy will accept all offers of partnership, even if it
        already has a partner.  ZIPPYBUGHOUSE must be at least 1 for
        partner tells to be relayed to the engine with the ptell
        command.

You may also want to customize other things by editing zippy.c and
recompiling the program.


ICS VARIABLE SETTINGS

You need to do the following settings on ICS:

    set highlight 0  <-- I'm not sure this is still needed
    set oldmatch 0
    set examine 0

If you want to use the ZIPPYPASSWORD remote-control feature, it's a
good idea to do the following, so that commands you give Zippy won't
be truncated because the ICS wrapped a "tell" to a new line:

    set wrap 0       <-- on ICC, or
    set width 255    <-- on FICS

You will probably want to turn on server-side autoflagging too:

    set autoflag 1

EXAMPLES

Here are some small example shell scripts and windows .BAT files.  You
may want to use more options; see the man page, info file, or help
file, and perhaps the FAQ file too.  A shell script or .BAT file is
simply a text file of commands.  On Unix, turn on execute permission
for the file (chmod a+x file); on Windows, give it the extension .BAT.
You can then run it just like an ordinary program.  Please do not ask
me questions about how to make a shell script or .BAT file; these are
not functions of xboard/WinBoard, but basic operating system features
that you can learn about from introductory books, friends, teachers,
or the online help for your system.  The examples below should be more
than enough to get you started.

Unix shell scripts:

#! /bin/csh
# xboard + GNU Chess on chessclub.com
setenv ZIPPYPASSWORD beer
xboard -zp -ics -icshost chessclub.com -icshelper timestamp

#! /bin/csh
# xboard + GNU Chess on freechess.org
setenv ZIPPYPASSWORD beer
xboard -zp -ics -icshost freechess.org -icshelper timeseal

#! /bin/csh
# xboard + Crafty on chessclub.com
setenv ZIPPYPASSWORD beer
xboard -zp -ics -icshost chessclub.com \
    -fd /home/crafty -fcp crafty -icshelper timestamp

#! /bin/csh
# xboard + Crafty on freechess.org
setenv ZIPPYPASSWORD beer
xboard -zp -ics -icshost freechess.org -autoflag \
    -fd /home/crafty -fcp crafty -icshelper timeseal

Windows .BAT files:

REM WinBoard + GNU Chess on chessclub.com
set ZIPPYPASSWORD=beer
WinBoard -zp -ics -icshost chessclub.com -fcp GNUChess -icshelper timestamp

REM WinBoard + GNU Chess on freechess.org
set ZIPPYPASSWORD=beer
WinBoard -zp -ics -icshost freechess.org -fcp GNUChess -icshelper timeseal

REM WinBoard + Crafty on chessclub.com
set ZIPPYPASSWORD=beer
WinBoard -zp -ics -icshost chessclub.com -fd C:\Crafty -fcp WCrafty -icshelper timestamp

REM WinBoard + Crafty on freechess.org
set ZIPPYPASSWORD=beer
WinBoard -zp -ics -icshost freechess.org -fd C:\Crafty -fcp WCrafty -icshelper timestamp

