[comp.sources.misc] v18i012: notation - Chess text converter, Part01/03

hthomas@irisa.fr (Henry Thomas) (04/12/91)

Submitted-by: Henry Thomas <hthomas@irisa.fr>
Posting-number: Volume 18, Issue 12
Archive-name: notation/part01

This program reads chess games, either full algebraic or shortened (ie
Nf1-g3 or f1g3 or Ng3) and is able to ouptut the board after any move, in
ascii form, postscript, or nroff or suitable for some TeX macros.
Also, it can generate output for gnuan and the xboard program.

It is multi-lingual (european) for piece identification. The program
understand french, english, german, spanish dutch and italian. Send me
piece symbols for other languages(dannish, swedish, russian,
portugese...), I will incorporate them happily.

This is a freeware program. You have the right to modify it, give it,
provided you don't modify the copyright notice and my name still
remains. 

This program is ok on Sun Sparc Station and Sun-3. It uses standard C,
and I guess won't be too difficult to compile on a IBM-PC with MSC. 
See the README for additional information.

If you're happy with this program, let me know. Also, I'm interested
in any advice to a novice player of chess. I would appreciate if
someone might give me advice about openings: overview, what they are
for, which ones are not too risky for a novice etc... Thanks.

I hope the program is clear enough to be easily modified. Anyway, I
would like to centralize modifications, in order to manage an
up-to-date version. So send me the modifications, in forms of diff
files, if possible, along with the version number of the program.

Henry
----------
#! /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 1 (of 3)."
# Contents:  . BUGSREPORT CHANGES Footer.ps HELPFILE Header.ps
#   Header.tex MANIFEST Makefile README TODO algebric.txt chesstype.h
#   drivers.h keywords.txt lexer.c lexer.h notation.h notation.n
#   print-ps shortened.txt
# Wrapped by hthomas@yole on Thu Apr 11 14:28:52 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'BUGSREPORT' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'BUGSREPORT'\"
else
echo shar: Extracting \"'BUGSREPORT'\" \(604 characters\)
sed "s/^X//" >'BUGSREPORT' <<'END_OF_FILE'
X14/12/90
Xsome functions implemented as macros
Xcasting to void generalized when results not used
Xadd a boldface to move number in tex driver
X
X13/12/90
XAdd a \n output at begin of ascii driver
X
X13/12/90
XPatches some errors in man page: 
X- @configblack entry
X- pawn dutch symbol
X- an example (translation from dutch to spanish): -t instead of -o
X
X13/12/90
XJacques Shuurman pointed that the duch symbol for Pawn should be "O".
XCorrected
X
X12/12/90
XPatched an extra instruction in assoc_driver(), that force force tex
Xoutput to be in english
X
X12/12/90
Xdebug version will be 1.7
X
X12/12/90
XReleased version 1.6
X
END_OF_FILE
if test 604 -ne `wc -c <'BUGSREPORT'`; then
    echo shar: \"'BUGSREPORT'\" unpacked with wrong size!
fi
# end of 'BUGSREPORT'
fi
if test -f 'CHANGES' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'CHANGES'\"
else
echo shar: Extracting \"'CHANGES'\" \(393 characters\)
sed "s/^X//" >'CHANGES' <<'END_OF_FILE'
X** 11/05/91 NEW VERSION. Many many improvements: en-passant,
Xpromotion. Split the source in many differents file. Programming style
Ximproved etc...
X
X** 20/03/91 gnu driver has change. It is now named "xchess". The "gnu"
Xname is now used for "gnuan" type files.
X
X** much improved latex output
X
X** improved internal move generation
X
X** added @special keyword, to directly include text in output
END_OF_FILE
if test 393 -ne `wc -c <'CHANGES'`; then
    echo shar: \"'CHANGES'\" unpacked with wrong size!
fi
# end of 'CHANGES'
fi
if test -f 'Footer.ps' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Footer.ps'\"
else
echo shar: Extracting \"'Footer.ps'\" \(196 characters\)
sed "s/^X//" >'Footer.ps' <<'END_OF_FILE'
X2 ENDPAGE
X%%PageTrailer
X%%PageFonts: Times-Roman Cheq 
X%%PageBoundingBox: 20 20 576 756 
X%%Trailer
Xend %PROLOGUE
X%%Pages: 1 
X%%BoundingBox: 20 20 576 756 
X%%DocumentFonts: Times-Roman Cheq 
X%%EOF
END_OF_FILE
if test 196 -ne `wc -c <'Footer.ps'`; then
    echo shar: \"'Footer.ps'\" unpacked with wrong size!
fi
# end of 'Footer.ps'
fi
if test -f 'HELPFILE' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'HELPFILE'\"
else
echo shar: Extracting \"'HELPFILE'\" \(958 characters\)
sed "s/^X//" >'HELPFILE' <<'END_OF_FILE'
XCommand line options:
Xnotation [options]
X	where options are
X	-a		: algebraic move notation output
X	-s		: shortened move notation output
X	-f <language>	: specify the chess symbol input language .The
X			language  can be any of:
X		french
X		english
X		italian
X		spanish
X		german
X		dutch
X	-t <language>	: specify the chess symbol output language.
X			Same options as input language
X	<inputfile>	: specify the input file. If none, keyboard is assumed
X	-o <outputfile>	: specify the output file. If none, screen is assumed
X	-c <number>[,<number]	: specify the number of the moves to display
X			the board. if none, board is diplayed at end of file
X	-e <number>     : display the board at the move number and then stops
X	-b		: display only the board, not the moves
X	-d <drivername>	: specify the output driver. It can be any of
X			the following:
X		ascii
X		postscript
X		tex 	(latex)
X		roff
X		xchess 	(xchess save format)
X		gnu	(gnuan input format)
X	-h		: show this help
END_OF_FILE
if test 958 -ne `wc -c <'HELPFILE'`; then
    echo shar: \"'HELPFILE'\" unpacked with wrong size!
fi
# end of 'HELPFILE'
fi
if test -f 'Header.ps' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Header.ps'\"
else
echo shar: Extracting \"'Header.ps'\" \(2180 characters\)
sed "s/^X//" >'Header.ps' <<'END_OF_FILE'
X%!PS-Adobe-2.1
X%%% HOW TO USE:  from Unix, "cat Cheq Example | lpr -Pprintername "
X%%Title: Cheq.cheqtxtx
X%%Creator: Glenn Reid and still.ps (V 1.0d release 10 edit 08)
X%%BoundingBox: (atend)
X%%Pages: (atend)
X%%DocumentProcSets: Adobe_distill 0.95
X%%EndComments
X%%BeginProcSet: Adobe_distill 0.95
X/PROLOGUE 30 40 add dict def
X % 30 procedure entries + room for 40 cached font dictionaries
X PROLOGUE begin
X /clip { } def    % causes problems. remove if "clip" is needed
X /bdef { bind def } bind def	/ldef { load def } bdef
X /T { moveto show } bdef	/A { moveto ashow } bdef
X /W { moveto widthshow } bdef	/AW { moveto awidthshow } bdef
X /f /fill ldef			/R { { rlineto } repeat } bdef
X /r /rlineto ldef		/L { { lineto } repeat } bdef
X /m /moveto ldef		/l { moveto lineto stroke } bdef
X /x { 0 rlineto } bdef		/y { 0 exch rlineto } bdef
X /c /curveto ldef		/cp /closepath ldef
X /s /stroke ldef		/w /setlinewidth ldef
X /g /setgray ldef		/j /setlinejoin ldef
X /d /setdash ldef		/F /setfont ldef
X /C /setcmykcolor where { /setcmykcolor get }{ %ifelse
X   { %def
X     1 sub 3 { 3 index add neg dup 0 lt { pop 0 } if 3 1 roll } repeat
X     setrgbcolor
X   } bind
X } ifelse def
X /MF { findfont exch makefont setfont } bdef
X /DF { findfont exch scalefont setfont currentfont def } bdef
X /BEGINPAGE { pop /pagesave save def } bdef
X /ENDPAGE { pop pagesave restore showpage } def
X /REMAP { %def
X   FontDirectory 2 index known { pop pop pop } { %ifelse
X     findfont dup length dict begin
X       { 1 index /FID ne {def}{pop pop} ifelse } forall
X       exch dup length 0 gt { /Encoding exch def }{ pop } ifelse
X     currentdict end definefont pop
X   } ifelse
X } bdef
X /RECODE { %def
X    3 -1 roll 1 index findfont /Encoding get 256 array copy exch
X    0 exch { %forall
X     dup type/nametype eq
X       { 3 {2 index} repeat put pop 1 add }{ exch pop }ifelse
X    } forall pop 3 1 roll REMAP
X } bdef
X end %PROLOGUE
X%%EndProcSet: Adobe_distill 0.95
X%%EndProlog
X%%BeginSetup
XPROLOGUE begin
X
X%%EndSetup
X%%Page: 1 1
X%%PageFonts: (atend)
X%%PageBoundingBox: (atend)
X1 BEGINPAGE
X1 1 1 0 C
X/F1 12 /Times-Roman DF
X(output of program notation, using font Cheq \(gift of Adobe Systems\))
X72 756 T
X/F2 30 /Cheq DF
END_OF_FILE
if test 2180 -ne `wc -c <'Header.ps'`; then
    echo shar: \"'Header.ps'\" unpacked with wrong size!
fi
# end of 'Header.ps'
fi
if test -f 'Header.tex' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Header.tex'\"
else
echo shar: Extracting \"'Header.tex'\" \(1477 characters\)
sed "s/^X//" >'Header.tex' <<'END_OF_FILE'
X% Header for chess printing
X\documentstyle[twocolumn]{article}
X\font\chess=chess20
X\font\figchess=chessfig10
X%
X%figures
X\def\FigK{{\figchess K}}
X\def\FigQ{{\figchess Q}}
X\def\FigR{{\figchess R}}
X\def\FigB{{\figchess B}}
X\def\FigN{{\figchess N}}
X\def\FigP{}
X\def\FigVoid{}
X\def\FigDash{--}
X\def\FigCapt{$\times$}
X%\def\FigDots{~$\ldots$,}
X\def\FigDots{$\ldots$}
X\def\FigDot{\char46}
X%
X% white pieces on white
X\def\WKW{{\chess K}}
X\def\WQW{{\chess Q}}
X\def\WRW{{\chess R}}
X\def\WBW{{\chess B}}
X\def\WNW{{\chess N}}
X\def\WPW{{\chess P}}
X% white pieces on black
X\def\WKB{{\chess J}}
X\def\WQB{{\chess L}}
X\def\WRB{{\chess S}}
X\def\WBB{{\chess A}}
X\def\WNB{{\chess M}}
X\def\WPB{{\chess O}}
X% black pieces on white
X\def\BKW{{\chess k}}
X\def\BQW{{\chess q}}
X\def\BRW{{\chess r}}
X\def\BBW{{\chess b}}
X\def\BNW{{\chess n}}
X\def\BPW{{\chess p}}
X% black pieces on black
X\def\BKB{{\chess j}}
X\def\BQB{{\chess l}}
X\def\BRB{{\chess s}}
X\def\BBB{{\chess a}}
X\def\BNB{{\chess m}}
X\def\BPB{{\chess o}}
X% white empty 
X\def\WWW{{\chess 0}}
X% black empty */
X\def\DDD{{\chess Z}}
X%
X\def\vvrule{\vrule width1pt} \def\hhrule{\hrule height1pt}
X%
X\newcommand{\movenumber}[1]{\noindent\makebox[1.5cm][r]{#1}}
X\newcommand{\whitemove}[1]{\makebox[2cm][r]{#1}}
X\newcommand{\blackmove}[1]{\makebox[2cm][r]{#1}~\\}
X
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X\begin{document}
X%\title{Notation Output}
X%\author{notation program (C) Henry Thomas 1990}
X%\date{\today}
X%\maketitle
END_OF_FILE
if test 1477 -ne `wc -c <'Header.tex'`; then
    echo shar: \"'Header.tex'\" unpacked with wrong size!
fi
# end of 'Header.tex'
fi
if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'MANIFEST'\"
else
echo shar: Extracting \"'MANIFEST'\" \(0 characters\)
sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
END_OF_FILE
if test 0 -ne `wc -c <'MANIFEST'`; then
    echo shar: \"'MANIFEST'\" unpacked with wrong size!
fi
# end of 'MANIFEST'
fi
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(2153 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X# Makefile for notation program
X# (C) Henry Thomas 1990
X
XFILES      = notation.c drivers.c lexer.c
XHEADERS	   = notation.h drivers.h lexer.h chesstype.h
X#LIBDIR     = ./lib
XLIBDIR     = .
XBINDIR=$(HOME)/local/bin.$(HOSTTYPE)
X
XOBJECTS    = notation.o drivers.o lexer.o
X
XOTHERFILES = Makefile HELPFILE \
X	keywords.txt algebric.txt shortened.txt \
X	notation.doc notation.n \
X	README TODO BUGSREPORT COPYING CHANGES \
X	print-ps \
X	Header.ps Footer.ps Header.tex \
X	MANIFEST
X
X
XSAVEFILES  = $(FILES) $(HEADERS) $(OTHERFILES)
X
XKITNAME	   = "Notation"
X
X############################################################
X# you might want to define the lib path : 
X#	do not forget the trailing /
X# ( the library is the place where the HELPFILE, Heading, fonts etc are)
X# also you can have default language for input/ouput
X# define DEFAULT_INPUT_LANGUAGE and DEFAULT_OUPUT_LANGUAGE
X# value can be:
X#	FRENCH, ENGLISH, GERMAN, ITALIAN, SPANISH, DUTCH
X# ANSI C/ TURBO C (MSDOS)
X# to compile with TURBO C or ANSI C, define TURBOC
XCFLAGS     = -DLIB_DIR=\"$(HOME)/echecs/notation_dir/\" \
X-DDEFAULT_INPUT_LANGUAGE=FRENCH -DDEFAULT_OUTPUT_LANGUAGE=FRENCH 
XLDFLAGS    =
X
X#CC= gcc -pedantic 
X
X############################################################
X
X.KEEPSTATE:
X
Xall: notation notation.doc
X
Xnotation: $(OBJECTS)
X	$(CC) $(CFLAGS) -o notation  $(OBJECTS) 
X
Xkit     : $(SAVEFILES)
X	makekit -n$(KITNAME) $(LIBDIR) $(SAVEFILES) > MANIFEST
X
Xshar     : $(SAVEFILES)
X	shar -o$(KITNAME).shar $(LIBDIR) $(SAVEFILES) 
X
Xzoo	: $(SAVEFILES)
X	chmod +w $(KITNAME).zoo
X	zoo -freshen $(KITNAME).zoo $(SAVEFILES)
X	rm -f $(KITNAME).bak
X	chmod -w $(KITNAME).zoo
X
Xsauve   :
X	make zoo
X	chmod +w $(KITNAME).zoo
X	cp $(KITNAME).zoo $(HOME)/local/sauve
X	chmod -w $(KITNAME).zoo
X
Xinstall:
X	make notation
X	strip notation
X	chmod +x print-ps
X	make notation.doc 
X
Xhthomas:
X	make install
X	mv notation $(BINDIR)
X
Xclean:
X	rm -f notation $(OBJECTS)
X
Xnotation.doc: notation.n
X	nroff -man notation.n > notation.doc
X
X
X# DO NOT DELETE THIS LINE -- make depend depends on it.
X
Xdrivers.o: chesstype.h notation.h drivers.h
Xlexer.o: chesstype.h notation.h lexer.h
Xnotation.o: chesstype.h drivers.h notation.h lexer.h
END_OF_FILE
if test 2153 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(3653 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
X** DESCRIPTION
X
XThis program read chess games, either full algebraic or shortened (ie
XNf1-g3 or f1g3 or Ng3) and is able to ouptut the board after any move, in
Xascii form, postscript, or nroff or suitable for some TeX macros.
XAlso, it can genearte output for gnuan and the xboard program.
X
XIt is multi-lingual (european) for piece identification. The program
Xunderstand french, english, german, spanish dutch and italian. Send me
Xpiece symbols for other languages(dannish, swedish, russian,
Xportugese...), it will incorporate them happily.
X
XThis is a freeware program. You have the right to modify it, give it,
Xprovided you don't modify the copyright notice and my name still
Xremains. 
X
XThe distribution has 3 shar-type files.
X
X** QUICK USE
X
XAnyway, you want to try quickly the program, 
Xissue the command "make" in this directory, and then 
Xtype "notation algebric.txt" to test the programm on Kasparov/Karpov
Xgame 13 (Lyon, November 1990).
X
XRead and modify the makefile for customizing notation to your national
Xlanguage and library path.
X
XIf you want a complete manual, read notation.doc.
X
XTo print a postscript file, use "print-ps file"
X
X** SOURCES
XThey are posted to "comp.sources.misc". You can also get them by mail,
Xfrom "hthomas@irisa.fr". I put them on anonymous ftp on
Xwuarchive.wustl.edu, (user:anonymous, password:<your address>). The
Xpath is "pub/Notation.shar".
X
X** IMPORTANT
XIf you want to use PostScript or LaTeX, you need two packages not
Xprovided here. However, here is a way to get them:
X
X**** Postscript: 
X  You need the font "Cheq", freely distributed by Adobe.  Send a mail
Xto "ps-file-server@adobe.com" with the body "send Programs
Xchessfont.ps". For use with "notation", rename the file "Cheq".
X
X------------------------------------------------------------------
Xchessfont.ps              58548 Jun 22 1989
X    This is the Adobe chess font "Cheq", created by John Renner. It 
X    is an ASCII downloadable version of the font that is not in any 
X    particular font format for a specific platform. See also
X    "chessfontUNIX.shar" and "chessfontMAC.shar" for the font bundled 
X    with other useful files like screen fonts and AFM files. If you 
X    just want the font, it is available in this file separately for 
X    convenience.
X------------------------------------------------------------------
X
X**** LaTeX: 
X  You need the chess fonts designed by Piet Tutalaers
X"rcpt@urc.tue.nl". The complete distribution is available on
Xsol.cs.ruu.nl (131.211.80.5) with path TEX/chess.tar.Z
X
X------------------------------------------------------------------
X-rw-r--r--  1 piet     staff        2984 Dec  3 10:11 chess.README
X-rwxr--r--  1 piet     staff      129679 Dec  3 15:57 chess.tar.Z
X------------------------------------------------------------------
X
X** DOCUMENTATION
XSee the file notation.doc for any info
X
X** COPYRIGHT
X
XThis is a freeware program. You have the right to modify it, give it,
Xprovided you don't modify the copyright notice and my name still
Xremains. 
X
XFor the others packages (Cheq and chess font, refers to the original
Xcopyright notice). 
X
X** USER FEEDBACK
X
XIf you're happy with this program, let me know. Also, I'm interested
Xin any advice to a novice player of chess. I would appreciate if
Xsomeone might give me advices obout openings: overview, what they are
Xfor, which ones are not too risky for a novice etc... Thanks.
X
X
X** MODIFICATIONS
X
XI hope the program to be clear enough to be easily modified. Anyway, I
Xwould like to centralize modification, in order to manage an
Xup-to-date version. So send me the modification, in forms of diff
Xfiles, if possible, along with the version number of the program.
X
END_OF_FILE
if test 3653 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'TODO' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'TODO'\"
else
echo shar: Extracting \"'TODO'\" \(336 characters\)
sed "s/^X//" >'TODO' <<'END_OF_FILE'
XA lot of things remains to do:
X
Xinput/output
X- handle comments
X- handle variations
X- allows special comments to specify title
X- allows command-line options to specify title
X- handle half-move for displaying output
X
X
Xfrom a programming point of vue:
X- improve the lexer
X- handle comments to have then in the output file
X- detect check
X
X
END_OF_FILE
if test 336 -ne `wc -c <'TODO'`; then
    echo shar: \"'TODO'\" unpacked with wrong size!
fi
# end of 'TODO'
fi
if test -f 'algebric.txt' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'algebric.txt'\"
else
echo shar: Extracting \"'algebric.txt'\" \(958 characters\)
sed "s/^X//" >'algebric.txt' <<'END_OF_FILE'
X
X[WORLD CHESS CHAMPIONSHIP]
X[GAME 13 Adjourned]
X[November 24, 1990]
X
X[   KARPOV      KASPAROV]
X 1. d2-d4      g8-f6
X 2. c2-c4      g7-g6
X 3. b1-c3      d7-d5
X 4. c4Xd5      f6Xd5
X 5. e2-e4      d5Xc3
X 6. b2Xc3      f8-g7
X 7. c1-e3      c7-c5
X 8. d1-d2       O-O
X 9. a1-c1      d8-a5
X10. g1-f3      e7-e6
X11. d4-d5      e6Xd5
X12. e4Xd5      f8-e8
X13. f1-e2      c8-f5
X14.  O-O       b8-d7
X15. h2-h3      d7-b6
X16. g2-g4      f5-d7
X17. c3-c4      a5Xd2
X18. f3Xd2      b6-a4
X19. e2-f3      a4-c3
X20. c1Xc3      g7Xc3
X21. d2-e4      e8Xe4
X22. f3Xe4      a8-e8
X23. e4-d3      b7-b6
X24. g1-g2      f7-f5
X25. g4Xf5      d7Xf5
X26. d3Xf5      g6Xf5
X27. f1-d1      g8-f7
X28. d1-d3      c3-f6
X29. d3-a3      a7-a5
X30. a3-b3      f6-d8
X31. b3-c3      d8-c7
X32. a2-a4      f7-f6
X33. g2-f1      f5-f4
X34. e3-c1      f6-f5
X35. c3-c2      e8-g8
X36. c2-e2      c7-e5
X37. c1-b2      e5-d4
X38. b2Xd4      c5Xd4
X39. e2-e7      d4-d3
X40. f1-e1      g8-c8
X41. e1-d2      c8Xc4
X
X
X
END_OF_FILE
if test 958 -ne `wc -c <'algebric.txt'`; then
    echo shar: \"'algebric.txt'\" unpacked with wrong size!
fi
# end of 'algebric.txt'
fi
if test -f 'chesstype.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'chesstype.h'\"
else
echo shar: Extracting \"'chesstype.h'\" \(2385 characters\)
sed "s/^X//" >'chesstype.h' <<'END_OF_FILE'
X/* notation program */
X/* types definition */
X#ifndef _HEADERS_TYPES
X#define _HEADERS_TYPES
X
X#define FALSE 0
X#define TRUE  1
X
X#ifndef NULL
X#define NULL    ((char *) 0)
X#endif
X
X#define MAX(a,b)  ((a)>(b)?(a):(b))
X#define MIN(a,b)  ((a)<(b)?(a):(b))
X#define ABS(a)	  ((a)>=0?(a):(-(a)))
X#define SIGN(a)   ((a)>=0?(1):-1)
X
X#define DUMMYCHAR '$'
X#define MAXTOKLEN 1024
X
X
X/* max number of move for displaying board */
X#define NB_MOVE_TO_DISP 128
X
X/* debugging help */
X#ifdef DEBUG
X#define MESSAGE(A) (void) fprintf A
X#define ACTION(A)  A
X#else
X#define MESSAGE(A)
X#define ACTION(A)
X#endif
X
X/* output move format */
X
X#define ALGEBRAIC 0
X#define SHORTENED 1
X
X/* -------------------------------------------- */
X/*              chess data structures           */
X/* -------------------------------------------- */
X
X#define NUMPIECES 7
X
X#define KING   1
X#define QUEEN  2
X#define ROOK   3
X#define BISHOP 4
X#define KNIGHT 5
X#define PAWN   6
X
X#define VOID  0
X#define WHITE 1
X#define BLACK 2
X
X/* board and move representation */
X/* board size */
X#define SIZE 10 
X
X/* ---- structure to represent the game ---- */
Xtypedef struct {
X
X  /* board definition */
X  int board[SIZE][SIZE];
X  int color[SIZE][SIZE];
X
X} game ;
X/* ---- end of structure ---- */
X
X#define GULL (game *) 0
X
X/* french(roque) == english(castling) */
X
X#define MOVE		1  	/* un mouvement        */
X#define PRISE		2      	/* une prise           */
X#define GRANDROQUE	3 	/* grand roque         */
X#define PETITROQUE	4 	/* petit roque         */
X#define EN_PASSANT	5	/* prise en passant    */
X#define PROMOTION  	6	/* promotion           */
X#define PROM_ET_PRISE	7	/* promotion + capture */
X
X#define SHORT_COMMENT_LEN 4
X
X/* structure used to describe the current move */
Xtypedef struct {
X  int move ;		/* number of the move */
X  int whiteturn ; 	/* boolean to tell white's turn */
X
X  int type;		/* type of move: MOVE, PRISE, etc..   */
X  int piece;		/* type of the piece */
X
X  int fromcol, fromlig;	/* from position */
X  int tocol, tolig ;	/* destination   */
X
X  int prise;		/* captured piece */
X  int promotion;        /* name of the pice the pawn is promoted to */
X
X  int is_check[3] ;	/* = { 0, FALSE, FALSE }*/
X
X  char comment[SHORT_COMMENT_LEN];	/* short text comment */
X  char * text ;         /* long text comment */
X}  depl ;
X
X#define MULL (depl *) 0
X
X#define CURCOLOR(M) (((M)->whiteturn)?(WHITE):(BLACK))
X
X/* end headers */
X#endif
END_OF_FILE
if test 2385 -ne `wc -c <'chesstype.h'`; then
    echo shar: \"'chesstype.h'\" unpacked with wrong size!
fi
# end of 'chesstype.h'
fi
if test -f 'drivers.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'drivers.h'\"
else
echo shar: Extracting \"'drivers.h'\" \(1675 characters\)
sed "s/^X//" >'drivers.h' <<'END_OF_FILE'
X/* notation program */
X/* headers for output drivers */
X#ifndef _HEADERS_DRIVERS
X#define HEADERS_DRIVERS
X
X
X#define D_ASCII  0
X#define D_POST   1
X#define D_TEX    2
X#define D_ROFF   3
X#define D_XCHESS 4
X#define D_GNU    5
X
X#define NB_DRIVER 6
X
X
X
X#define PS_HEADER  "Header.ps"
X#define PS_FOOTER  "Footer.ps"
X#define TEX_HEADER "Header.tex"
X
X
X/* output buffers */
X#define TAMPON 256
X
Xtypedef struct {
X
X  /* type of driver */
X  int type ;
X
X  /* output_file */
X  FILE *outfile ;
X  /* these  booleans control the output format */
X  int print_move    ;  /* move numbering */
X  int print_piece   ;  /* print piece name */
X  int print_pawn    ; /* print the PAWN name */
X  int roque_alg     ; /*  roque in algebraic form Ke1g1 or O-O */
X  int print_liaison ; /* print the - or x in move output */
X  int only_board ;
X
X  int variation_level ;
X
X  /* boolean to print the coordinates in ascii output of board */
X  int coordinates   ;
X  int output_move_format ;
X
X  char *out_table;	/* translation table */
X
X  /* procedures */
X  void (*out_init)() ;
X  void (*out_move)() ;
X  void (*out_board)() ;
X  void (*out_end)() ;
X
X  /* temp vars  used by move buffering */
X
X  int iswhiteturn ; /*= FALSE */
X  int interrupt ; /*= FALSE */
X
X  char move_buffer[TAMPON]  /*= ""*/ ;
X  char white_buffer[TAMPON] /*= ""*/ ;
X  char black_buffer[TAMPON] /*= ""*/ ;
X
X
X} format ;
X
X
X/* fonctions ----------------- */
X
Xextern void output_init(/*format *dr*/);
Xextern void output_move(/*format *dr, depl *d*/);
Xextern void output_board(/*format *dr, game *g*/);
Xextern void output_end(/*format *dr*/);
X
Xextern format *new_driver(/*void*/);
Xextern void init_driver(/*format *dr, int driver, int olboard*/);
X
X#endif
END_OF_FILE
if test 1675 -ne `wc -c <'drivers.h'`; then
    echo shar: \"'drivers.h'\" unpacked with wrong size!
fi
# end of 'drivers.h'
fi
if test -f 'keywords.txt' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'keywords.txt'\"
else
echo shar: Extracting \"'keywords.txt'\" \(237 characters\)
sed "s/^X//" >'keywords.txt' <<'END_OF_FILE'
X[Example of keywords use]
X[absolutely non-sense game]
Xe2-e4 c7c6
X@showboard
X@clearboard
X@showboard
X@configwhite
X d4    Nf6
X Nc3   @showboard d5
X@configblack
X Kg8
X@startplay
X@showboard
X@blacksmove
XRg8-g7 @showboard d5-d6
XRg7-f6
X
X@null
X
X
X
END_OF_FILE
if test 237 -ne `wc -c <'keywords.txt'`; then
    echo shar: \"'keywords.txt'\" unpacked with wrong size!
fi
# end of 'keywords.txt'
fi
if test -f 'lexer.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'lexer.c'\"
else
echo shar: Extracting \"'lexer.c'\" \(2155 characters\)
sed "s/^X//" >'lexer.c' <<'END_OF_FILE'
X#include <stdio.h>
X
X#include "chesstype.h"
X#include "notation.h"
X#include "lexer.h"
X
X/*token */
Xstatic char curtok[MAXTOKLEN];
X
Xextern FILE * infile ;
X
X/* commentary level 
X act as a boolean too */
Xstatic int comment = FALSE;
X
X
Xstatic char nextchar()
X{
X  if (!feof(infile))
X    return(getc(infile));
X  else
X    return('\0');
X}
X
X
X
X/* this function returns the next token:
X   Definition of a token:
X   a number [0-9]*. ie 1. ,  35. 
X   a string terminated by a blank or rc or "." or tab
X   commentary enclosed in 90 or [] are skipped
X   Each move must not have a blank inside ie exc6 legal,
X   but not e x c6
X   */
Xint nexttoken()
X{
X  int i =0;
X  char c;
X  
X  /*(void) fprintf(stdout, "nexttoken\n");*/
X  curtok[0]= '\0' ;
X  c = nextchar();
X  while ((c == ' ') || (c == '\n') || (c == '\t') || (c== '.') || 
X	 ( c== '[') || (c =='(' ) ||  comment ) {
X    /*(void) fprintf(stdout, "=%c",c);*/
X    switch (c) {
X    case '[':
X    case '(':
X      comment++;
X      break;
X    case ']':
X    case ')':
X      comment--;
X      break;
X    default:
X      break;
X    }
X    c = nextchar();
X  }
X
X  if (c == '\0') return (FALSE);
X
X  while ( c != ' ' && c != '\n' &&  c != '\t' &&
X	 c != '.'  && c != '\0' && c != '[' && c!= '(' &&
X	 i < MAXTOKLEN ) {
X    curtok[i++] = c ;
X    c = nextchar();
X  }
X  if ( c== '.' )
X    curtok[i++] = c ;
X  
X  curtok[i] = '\0' ;
X  if ( c == '[' || c == '(' )
X    comment++;
X
X  if (c == '\0') return (FALSE);
X    
X  /*(void) fprintf(stdout,"---%s---\n",curtok);*/
X  return(TRUE);
X}
X
X
X/* this function parse the current token */
Xint parsetoken()
X{
X  int i;
X  register int c;
X
X
X  /* look for keyword */
X  if (curtok[0] == '@') /* keyword case */ 
X    return(parse_keyword(curtok));
X  
X  /* look for roque */
X  if (parse_roque(curtok))
X    return(TRUE);
X
X  /* is it a move numbering ? */
X  if ((curtok[0] >= '0') && (curtok[0] <= '9' )) {
X    return(parse_number(curtok) );
X  }
X
X  /* last option: it is a move 
X     Syntax of a move:
X     [] denote a range]
X     () denote a 0/1 (absence/presence)
X     
X     ((Piece Name)[a-h]([1-8])[x-])(PieceName)[a-h][1-8]
X
X     We use an automata here.
X     */
X  parse_move(curtok);
X
X  
X  return(TRUE);
X}
X
END_OF_FILE
if test 2155 -ne `wc -c <'lexer.c'`; then
    echo shar: \"'lexer.c'\" unpacked with wrong size!
fi
# end of 'lexer.c'
fi
if test -f 'lexer.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'lexer.h'\"
else
echo shar: Extracting \"'lexer.h'\" \(119 characters\)
sed "s/^X//" >'lexer.h' <<'END_OF_FILE'
X
X#ifndef _HEADER_LEXER
X#define _HEADER_LEXER
X
Xextern int nexttoken(/*void*/);
Xextern int parsetoken(/*void*/);
X
X#endif
END_OF_FILE
if test 119 -ne `wc -c <'lexer.h'`; then
    echo shar: \"'lexer.h'\" unpacked with wrong size!
fi
# end of 'lexer.h'
fi
if test -f 'notation.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'notation.h'\"
else
echo shar: Extracting \"'notation.h'\" \(3383 characters\)
sed "s/^X//" >'notation.h' <<'END_OF_FILE'
X/* notation program */
X#ifndef _NOTATION_HEADERS
X#define _NOTATION_HEADERS
X
X
X/* ---- KEYWORDS ----  */
X
X/* prefix for keywords */
X#define PREFIX '@'
X
X#define NBKEYWORD 10
X
X#define START     0
X#define CLEAR     1
X#define SHOWBOARD 2
X#define TOWHITE   3
X#define TOBLACK   4
X#define CONFIGWH  5
X#define CONFIGBL  6
X#define DEFAULTP  7
X#define SPECIAL   8
X#define KNULL     9
X
X
X/* ---- LANGUAGES ---- */
X
X#define FRENCH  0
X#define ENGLISH 1
X#define ITALIAN 2
X#define SPANISH 3
X#define GERMAN  4
X#define DUTCH   5
X#define RUSSIAN 6
X
X#define NBLANGUAGE 6
X
X#ifndef DEFAULT_INPUT_LANGUAGE
X#define DEFAULT_INPUT_LANGUAGE  FRENCH
X#endif
X
X#ifndef DEFAULT_OUTPUT_LANGUAGE
X#define DEFAULT_OUTPUT_LANGUAGE FRENCH
X#endif
X
X/* ---- MISC TABLES ---- */
X
X/* roque ascii table */
X#define NBROQUE     6
X#define SPETITROQUE 0
X#define SGRANDROQUE 1
X
X
X/* ---- DRIVERS ---- */
X
X/* output drivers name table */
X#define DEFAULT_DRIVER D_ASCII
X
X/* ---- IO ---- */
X
X#ifndef LIB_DIR
X#define LIB_DIR    "./lib/"
X#endif
X
X#define HELP_FILE  "HELPFILE"
X
Xextern FILE * infile;
X
X/* ------------- service routines -------------------*/
X
X/* Output an error message and exit */
X#define fatal(A) (void) fprintf A , close_files() , exit(1)
X
X/* Output an error message and set the error flag */
X#define error(A) (void) fprintf A , error_flag = TRUE , (void)fflush(stderr)
X
X/* Output an error message and set the error flag */
X#define message(A) (void) fprintf A 
X
X#define MALLOC(T)  (T *)malloc((unsigned)sizeof(T))
X#define ALLOCP(P)  if ( (P) == NULL ) { fatal(("malloc failed")) ; };
X
X/* ------- conversion of input character --------------------- */
X
X#define lettertocol(c)  ((c)-'a'+1)
X#define lettertolig(c)  ((c)-'1'+1)
X#define coltoletter(n)  ((n)-1+'a')
X#define ligtoletter(n)  ((n)-1+'1')
X
X
X/* ------- variables and functions --------------------------- */
Xextern char *version_string;
Xextern int configuring;
Xextern int configside;
Xextern char *in_table;
Xextern char *out_table;
Xextern char *c_roque[];
Xextern char *c_en_passant[];
Xextern char c_prise;
Xextern char *c_comments[];
Xextern int error_flag;
X
X/* ---------- service routines ---------- */
X
Xextern void clear_board(/*game *g*/);
Xextern game *new_board(/*void*/);
Xextern void init_board(/*game *tgm*/);
Xextern depl *new_move(/*void*/);
Xextern void init_move(/*depl *m*/);
X
X
X/* ------ parse and analysis routines ------ */
X
Xextern int in_board(/*int l, int c*/);
Xextern int path_free(/*int l1, int c1, int l2, int c2*/);
Xextern int check_roque(/*void*/);
Xextern int guess_piece(/*void*/);
Xextern int guess_depl(/*int nb, int tab[][2], int *pl1, int *pc1, int l2, int c2, int path*/);
Xextern int ambiguity(/*int frompiece, int l2, int c2*/);
Xextern int check_move(/*depl *m*/);
Xextern int guess_move(/*void*/);
Xextern int clear_pos(/*int lig, int col*/);
Xextern int configure(/*void*/);
Xextern int execute_move(/*void*/);
Xextern int typechar(/*char c*/);
Xextern int execute(/*int num, char c*/);
Xextern int parse_number(/*char *token*/);
Xextern int parse_keyword(/*char *token*/);
Xextern int parse_roque(/*char *token*/);
Xextern int parse_move(/*char *token*/);
Xextern void init_parse(/*depl *m*/);
X
X
X/* ------ top-level interface functions -------- */
X
Xextern int parse_options(/*int argc, char *argv[]*/);
Xextern void close_files(/*void*/);
Xextern int associe_traduction(/*char **table, int langage*/);
Xextern int main(/*int argc, char *argv[]*/);
X
X
X#endif
END_OF_FILE
if test 3383 -ne `wc -c <'notation.h'`; then
    echo shar: \"'notation.h'\" unpacked with wrong size!
fi
# end of 'notation.h'
fi
if test -f 'notation.n' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'notation.n'\"
else
echo shar: Extracting \"'notation.n'\" \(9431 characters\)
sed "s/^X//" >'notation.n' <<'END_OF_FILE'
X.\" @(#)notation.n	2.1	4/11/91;
X.TH notation n "10 December 1990"
X
X.SH NAME
X
Xnotation \- transform chess notation
X
X.SH SYNOPSYS
X
Xnotation [input file] [-o output file] [options...]
X
X.SH DESCRIPTION 
X
XThis program reads chess games, either full algebraic or shortened (ie
XNf1-g3 or Ng3) and is able to ouptut the board after any move, in
Xeither ascii , postscript, nroff, latex or xchess save
Xformat. This program is also multi-lingual: it handles english,
Xfrench, spanish, german, italian and dutch symbols.
X
X.SH OPTIONS
XCommand line options:
X.TP 8
X.B	-a		
Xalgebraic move notation output
X.TP 8
X.B	-s		
Xshortened move notation output
X.TP 8
X.B      -f <language>	
Xspecifies the chess symbol input language. The language  can be any of
X\fBfrench\fR, \fBenglish\fR, \fBitalian\fR, \fBspanish\fR,
X\fBgerman\fR, \fBdutch\fR.
X.TP 8
X.B	-t <language>	
Xspecifies the chess symbol output language. Same options as input language.
X.TP 8
X.B <inputfile>
Xspecifies the input file. If none, keyboard is assumed.
X.TP 8
X.B	-o <outputfile>
Xspecifies the output file. If none, screen is assumed.
X.TP 8
X.B -c <number>[,<number]	
Xspecifies the \fBnumber\fR of the moves at which  to display the board. If
Xnone, board 
Xis displayed at end of file. Several numbers may be specified, as a
Xcomma-separated list.
X.TP 8
X.B -e <number>     
Xdisplay the board at the move \fBnumber\fR and then stops
X.TP 8
X.B	-b		
Xdisplay only the board, not the moves
X.TP 8
X.B	-d <drivername>	
Xspecifies the output driver. It can be any of the following:
X\fBascii\fR, \fBpostscript\fR, \fBtex\fR, \fBroff\fR, \fBxchess\fR
X(xchess or xboard save format), \fBgnu\fR (gnuan input format).
X.TP 8
X.B	-h		
Xdisplays help screen
X
X.SH "INPUT LANGUAGE"
X	
XThe input language has four types of input: moves, move numbers,
Xcomments and keywords. All these are separated by blanks, TAB or RC.
XCommas are not accepted.
X
X.TP 8
X.B move format:
XThe moves are accepted in algebraic or shortened algebraic
Xnotation. That means that the following are equivalent and accepted \fB
XNf1-g3 N-f1xg3, Nxg3, Ng3\fR. The ugly english notation \fBP-K4\fR is
Xnot understood, neither by the program nor me. 
X
XNota: provided you remove the three first line, xchess save format is
Xaccepted.  Also you can have trailing comments to move, provided there
Xis no blanks. So \fBKg4!!, Ra5++\fR are correct, but not \fBKg4 !!,
XRa5 ++\fR because of the separating blank. A future version might
Xhandle these move comments, as well as \fB + ++, mate, white
Xresigns\fR etc... Castling is recognized with the following \fB0-0
XO-O o-o 0-0-0 O-O-O o-o-o\fR. "En passant" and promotion are now
Xcorrectly handled. For "en passant", you just indicate them move and
Xit is correctly parsed ex: "d5-d7 e5xd6". Promotion is indicated with
Xthe "=" sign followed by the new piece name. So you just write
X"a7-a8=Q" or "d8=K".
X
XFor example, see the files \fBalgebraic.txt\fR and
X\fBshortened.txt\fR
X
X.TP 8
X.B move numbers:
Xmove numbers are in the form \fB23.\fR or \fB36\fR. The full
Xpoint is optional. Move numbers are checked against internal move
Xcounter. 
X
X.TP 8
X.B comments: 
Xanything else, except keywords, must be enclosed in brackets
Xor parenthesis \fB[Here Karpov made a very bright move ...]\fR
X\fB(this is also a comment)\fR. Comments are skipped out.  A future
Xversion might incorporte them in the output.
X
X.TP 8
X.B keywords:
Xyou can insert keywords in the input text to precisely define
Xwhat you want: displaying the board, configuring it... Keywords are
Xdetailled in the next section.
X
X.SH KEYWORDS
XAll keywords are prefixed with \fB@\fR
X.TP8
X.B @startplay
Xbegins the play. Obligatory after a \fB@configxxx\fR keyword.
X.TP8
X.B @clearboard
Xclears the board. Used prior to any \fB@configxxx\fR.
X.TP8
X.B @showboard
Xdisplays the board. Can be used anywhere
X.TP8
X.B @whitesmove
Xtells the program that is the white's turn of play. Useful after a
X\fB@configxxx\fR and \fB@startplay\fR
X.TP8
X.B @blacksmove
Xtells the program that it is black's turn
X.TP8
X.B @configwhite
Xinitializes configuration of white side. Pieces are then expected, in
Xform of (optional for Pawn) name, the position. Example
X\fB@configwhite Ke3 Rg8 e4\fR.
X.TP8
X.B @configblack
Xinitializes configuration of black side. Pieces are then expected, in
Xform of (optional for Pawn) name, the position. Example:
X\fB@configblack Ka8 Nf6 e6\fR. 
X
XNote that black pieces are given in uppercase!
X.TP8
X.B @default
Xresets the board to the default start configuration.
X.TP8
X.B @special
Xall following text up to the next cariage return is not processed, but
Xinstead directly print. This allows to insert comments in ascii files,
Xor tex commands when tex output is selected. 
X.TP8
X.B @null
XNull keyword. Does nothing. Used for convenience in programming.
X
X
XSee the file \fBkeywords.txt\fR for an example of keywords use.
X
X.SH "NATIONAL LANGUAGES"
X
XHere are the symbols used in the differents languages. () mean
Xoptional in the input.
X
X
Xenglish-name	King	Queen	Rook	Bishop	Knight	Pawn
Xenglish		K	Q	R	B	N	(P)
Xfrench		R	D	T	F	C	(P)
Xitalian		R	D	T	A	C	(P)
Xspanish		R	D	T	A	C	(P)
Xgerman		K	D	T	L	S	(B)
Xdutch		K	D	T	L	P	(O)
X
X
X.SH DRIVERS
X.TP 8
X.B ascii
Xthis is the default driver, it outputs move and boards.
X.TP 8
X.B postscript
Xit generates a file using the font file \fBCheq\fR licensed for free
Xby Adobe. It is only able to display one board per run. Move are not
Xdisplayed. You need the font "Cheq", freely distributed by Adobe.
XSend a mail to "ps-file-server@adobe.com" with the body "send Programs
Xchessfont.ps". For use with "notation", rename the file "Cheq".
X.TP 8
X.B tex 
Xthis is a \fBlatex\fR driver. It uses the TeX/LaTeX chess macros
Xdesigned by Piet Tutalaers "rcpt@urc.tue.nl". The complete
Xdistribution is available on sol.cs.ruu.nl (131.211.80.5) with path
XTEX/chess.tar.Z \fBchesscls\fR, provided in the library. Refer to your
Xlocal latex guru to install it.
X.TP 8
X.B roff
Xthis is a driver for nroff output. It is crude, but it works. Moves and
Xboards are displayed.
X.TP 8
X.B xchess
XThis driver generates compatible xchess/xboard save files, thus allowing you
Xto replay a game with xchess.
X.TP 8
X.B gnu
XThis driver completely "bare" file, with only the algebraic move. It
Xis suitable for any low-level analyser, such as gnuan.
X
X.SH EXAMPLES
X	Try the following commands:
X.TP 8
X.B notation algebraic.txt
Xthis will read the Karpov-Kasparov game 13 (Lyon 1990) in algebraic form,
Xdisplay move in algebraic and display board at end of game.
X.TP 8
X.B notation algebraic.txt -a
Xthis will do the same thing, as \fB-a\fR stands for algebraic
Xoutput. 
X.TP 8
X.B notation algebraic.txt -s
Xthe game will now be output in shortened algebraic
X.TP 8
X.B notation shortened.txt
Xthere is no problem to read shortened algebraic.
X.TP 8
X.B notation shortened -s -o result
Xthe moves and board will be directed to file \fBresult\fR
X.TP 8
X.B notation shortened.txt -s -t french 
Xoutput will use french notation
X.TP 8
X.B notation a_dutch_file -f dutch -t spanish
Xgame will be translated form dutch to spanish
X.TP 8
X.B notation shortened -c 2
Xboard after move 2 will be displayed, along with moves and end-of-game
Xboard
X.TP 8
X.B notation shortened -e 2
Xboard after move 2 will be displayed, along with moves. The program
Xwill then stops
X.TP 8
X.B notation shortened -c 2,5,20
Xboard after moves 2, 5 and 20 will be displayed, along with moves and
Xend-of-game board
X.TP 8
X.B notation shortened -c 2,5,20 -b
Xboard after moves 2, 5 and 20 will be displayed, with end-of-game
Xboard, but no moves.
X.TP 8
X.B notation shortened -c 2,5,20 -d tex -o out.tex
Xthe output will be formatted to use with latex. You can directly latex
Xthe output file.
X.TP 8
X.B notation shortened -c 2,5,20 -d gnu -o out.gnu
Xyou can now replay the game by using \fBxchess -r out.gnu\fB.
X.TP 8
X.B notation shortened -e 5 -d postscript -o out.ps
XNow issue \fBcat lib/Cheq out.ps | lpr\fR to display on a Laser
XPrinter the board at move 5. You can also issue \fBsh print-ps
Xout-ps\fR.
XThe postcript driver does not support the \fB-c\fR option.
X
X.SH FILES
X
X.TP 8
X.B algebraic.txt shortened.txt keywords.txt
Xthese are examples of input files
X
X.TP 8
X.B ./lib/HELPFILE
Xthis is the on-line helpfile
X
X.TP 8
X.B ./lib/(Cheq Header.ps Footer.ps)
Xthese files are needed by the postscript driver
X
X.TP 8
X.B ./lib/Header.tex
Xthese file is needed by the (la)tex driver
X
X.TP 8
X.B ./lib/chesscls.mf
Xthis file is used the generate the tex font
X
X.SH "SEE ALSO"
Xxchess(1), chess(6), gnuchess(1), latex(1), nroff(1), lpr(1)
X
X.SH DIAGNOSTICS
XErrors messages are hoped to be self-explanative.
X
X.SH COMMENTS 
XThe program is quite large, due to the large use of tables and
Xvariables to control its features. The advantage is you only need the
Xmodify these tables to customize it: for instance adding a new
Xlanguage or tuning the output format to your own needs. 
X
X.SH BUGS
XToo many. Report them to \fBHenry.Thomas@irisa.fr\fr.
X
XThe postscript driver *might* fais if you try to display the board
Xtwo times. Anyway, it is not designed to do this. Use \fB-e\fR option
Xto specify the move at which you want to display board.
X
X.SH AUTHOR
XHenry Thomas IRISA-Rennes, FRANCE. E-mail to
X\fBHenry.Thomas@irisa.fr\fR or \fBhthomas@irisa.fr\fR.
X.SH "THANKS"
X
XThanks to Jacques Schuurman for the piece description in Dutch, Dr. Z.
XRubinstein, University of Haifa for the Metafont files, Philippe
XLouarn for implementing these macros and explaining me how to use
Xthem, Adobe Systems for the font Cheq, and Jean-Luc Scharbarg for
Xintroducing me in the world of chess.
END_OF_FILE
if test 9431 -ne `wc -c <'notation.n'`; then
    echo shar: \"'notation.n'\" unpacked with wrong size!
fi
# end of 'notation.n'
fi
if test -f 'print-ps' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'print-ps'\"
else
echo shar: Extracting \"'print-ps'\" \(134 characters\)
sed "s/^X//" >'print-ps' <<'END_OF_FILE'
X#!/bin/sh
X# printer for ps files using the font chess
X# args : files to print
XCHEQFILE="./Cheq"
Xfor i
Xdo
X	cat $CHEQFILE $i | lpr
Xdone
END_OF_FILE
if test 134 -ne `wc -c <'print-ps'`; then
    echo shar: \"'print-ps'\" unpacked with wrong size!
fi
chmod +x 'print-ps'
# end of 'print-ps'
fi
if test -f 'shortened.txt' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'shortened.txt'\"
else
echo shar: Extracting \"'shortened.txt'\" \(7012 characters\)
sed "s/^X//" >'shortened.txt' <<'END_OF_FILE'
X[This is the commentary from the USA Today Sports Center, written by
XIM Bjarke Kristiansen (and polished a bit by me).][ They are probably
Xthe quickest way to get the moves (perhaps AP access is quicker, I
Xdon't know how fast the AP gets updated on Compuserve); their number
Xfor subscribing (no online newuser service) is 800-826-9688.]
X
X[I was told it was okay to post this from there, as long as I gave
Xappropriate reference.]
X
X[WORLD CHESS CHAMPIONSHIP
XGAME 13 - Drawn after Adjournment
XNovember 24, 1990]
X
X[KARPOV  KASPAROV]
X
X1. d4    Nf6
X2. c4    g6
X3. Nc3   d5
X
X[Welcome to game 13th ..and the GI that's Grunfeld-Indian. Fight
Xfrom the start.]
X
X4. cxd5  Nd5
X5. e4    Nxc3
X6. bxc3  Bg7
X7. Be3   c5
X8. Qd2   O-O
X
X[So far on two minutes each. GK.. Garry Kasparov looks tensed, says
XMike Valvo. Now Karpov took full 9 minutes to play ...]
X
X9. Rc1   Qa5
X
X[Kasparov thought six minutes here. Time now: White 0:19 Black: 0:08.
XNow 9 minutes has gone and AK is still thinks. Kasparov has left
Xthe stage. Who is fooling who? 9..Qa5 might be a new move. Its
Xnot in the pressroom database. Karpov is still thinking, so time for a
Xlittle presentation. At your service in Lyon IM Bjarke Kristensen (Now Valvo:
XAK is nodding his head up and down alone on stage.) As kommentators:
XBoris Spassky and a number of strong french IM's. IM Mike Valvo from New Jersey
Xis here for a week.]
X
X10. Nf3   e6
X
X[And the 'soon-to-be' GM Will Watson from England is here too.
X'I don't understand the GI' he just said. Kasparov stays on stage.
XTime: White: 0:37 Black: 0:10. Says Will Watson (now WW): 'I
Xpredicted the opening this morning. And so did many others.'
XValvo: 'I think this shows that the Kings Indian hasn't worked
Xout for Kasparov'. IM Levy suggests b7-b6 for Black. IM Jonathan Tisdall says:
XI've seen this before. But nobody can find a game with it'.]
X
X11. d5    exd5
X12. exd5  Re8
X13. Be2
X
X[Time: White: 0:53 Black: 0:24. Valvo observed GK tapping his
Xfingers impatiently on the table after move Re8. It just might all
Xbe preparations! Both are sitting deeply concentrated at the table.]
X
X13. ...   Bf5
X14. O-O
X
X[The atmosphere in the pressroom is a bit 'fuzzy'. The game hasn't
Xfound it's own personality yet, and the fact that the US plays
Xthe Soviets at the Chess Olympiad in Novi Sad at this very moment is
Xalso widely discussed.]
X
X14. ...   Nd7
X
X[Interesting is now: 15.Nh4 Be4 16.f3 Bxd5! 17.Qxd5 Rxe3 18.Qxd7
X18...Rxe2 with a big Black plus. say Watson. Rumours say that
XGK might be better here, but nobody really dares to risk his
Xneck. The game is still in its childhood. But AK surely is in for
Xa deep think. Now he's on 1:16 and still thinking. Garry has left the
Xstage. Valvo say: The Mephisto computer thinks Black is better!
XIt's no 'Deep Thought', but the Mephisto Chess Computer IS
Xalready world champion in its class. No one else dared to test
Xtheir program against it!]
X
X15. h3
X
X[Time: White: 1:18 Black: 0:31. Now Karpov has left stage. And GK
Xhangs over the board as if to power up his chessmuscles. Kasparov seems
Xrelaxed and satisfied. White's problem is his weakened pawns on the Q-side.
XAnd as for his pride-pawn on d5? In an endgame it could be pure
Xgold, but until then it gives a good square to a Black piece
Xon d6. Kasparov now 'hangs' his head between his hands. A very typical
Xposture for the WC.]
X
X15. ...   Nb6
X
X[GM Lein thinks White is in deep trouble. GK might play Nb6-a4.
XAnother of GK's ideas might be Qa5-a4.]
X
X16. g4
X
X[Now ...that's a man! Karpov's idea obviously is 16... Be4 17.c4 Qxd2
X18.Nxd2 with 19.Nxe4 and 20.Bd3 to come. After a very slow start suddenly
Xthe game is very exciting. Now the Russians GMs in the pressroom find:
X16...Be4 17.c4.. Qa3! with a Black edge. But...]
X
X16. ...   Bd7
X
X[Time: AK: 1:31  GK: 0:49. GM-elects Watson and Gallagher say Karpov is still
Xunder pressure, but improving. Mephisto 'thinks' it's slightly better for
XBlack. And the Russians say that Kasparov should have played h7-h5, not
XNd7-b6.]
X
X17. c4    Qxd2
X18. Nxd2  Na4
X19. Bf3   Nc3
X20. Rxc3  Bxc3
X21. Ne4
X
X[The heat is on, in the Palais des Congress. Watson thinks GK is still
Xdoing well. Might be a British understatement. Kasparov is in for at deep
Xthink. Time: White: 1:42 Black: 1:12 IM Tisdall: He'll take on e4 now,
Xand it is a draw.]
X
X21. ...   Rxe4
X22. Bxe4  Re8
X23. Bd3   b6
X24. Kg2
X
X[Tisdall says: The first one who can bring himself to offer a draw
Xwill get it. He might be right. A drastic change of the game has
Xtaken place. And where did Kasparov drop his advantage? Maybe ...Nc3
Xshould have been prepared. Time: White: 1:46 Black: 1:17.
XIf Karpov plays Be3-c1 to press f2-f4 (hoping for an endgame
Xadvantage with f4-f5) GK might play Re8-e1 to enter a tame
Xdobble-bishop ending. Draw.]
X
X24. ...   f5
X25. gxf5  Bxf5
X26. Bxf5  gxf5
X
X[Karpov sits thinking alone at the board. Black's Bc3 is potentially weaker
Xthan Be3, but White's c4 pawn is GK's major target. I think that Black's
Xstill better. White's d-pawn looks strong (and it is) but right now it's
Xquite impotent. If advanced it'll just be lost, since Kg8 is to close.]
X
X27. Rd1   Kf7
X
X[Time: White: 2:07 Black: 1:28. Now Kasparov's lead on the clock
Xbegins to count. Karpov must be considering lines like: 28.d6 Ke6 29.Bf4
XBe5 30.Bxe5 Kxe5 31.Rd5+ Ke6 32.d7 Rd8 and Black is much better.]
X
X28. Rd3   Bf6
X29. Ra3   a5
X30. Rb3
X
X[Time: White: 2:12 Black: 1:31. It might look simple, but in fact
Xthe game is balanced on an edge. Which is most important: Black's
Xweakness on b6 or White's on c4?]
X
X30. ...   Bd8
X
X[People in the pressroom seems to be losing interest a bit. I think
Xthat a long endgame battle may be ahead. The fight for the
Xinitiative is still very much on. Now Watson arrived with news,..
Xhe said: The Russians think GK is slightly better, the Americans
Xthinks AK is slightly better and it might be a draw' says Watson.]
X
X31. Rc3
X
X[Both are leaning across the board. If Karpov can get his king to d3,
Xhe might play on forever. Kasparov seems 'speculative' now.
XOne point in Karpov's favour is: 31...Bc7 32.Kf3 Re4 33.Ke2 f4
X34.Kd3 and Re4 has to move.]
X
X31. ...   Bc7
X
X[Karpov is hiding his head behind his hands, looking through his
Xfingers. Nine minutes left.]
X
X32. a4    Kf6
X33. Kf1   f4
X
X[33...f4! GK played this with determination. I don't understand
XKarpov's Kg2-f1.]
X
X34. Bc1   Kf5
X35. Rc2   Rg8
X36. Re2   Be5
X37. Bb2   Bd4
X38. Bxd4  cxd4
X39. Re7   d3
X40. Ke1   Rc8
X41. Kd2   Rxc4
X
X[Kasparov has moved from c8 to c4. Move 41 made. The last seven
Xmoves took only 11 minutes Now all analysis goes: 42.Kxd3
XRxa4 43.d6 Ra3+ 44.Kc4 Ra1 45. Kd5 Rd1+ 46.Kc6 a4 and White
Xmight be the one who in trouble. Both still sits at the board. GK
Xis looking everywhere else, waiting for Karpov to decide on
Xif he want to sealed his move  now. Some say that Kasparov might
Xhave proposed a draw earlier on. Not verified. Time: 2:42 - 2:08.
XKarpov sealed his 42nd move. The game will be continued (maybe)
Xtomorrow at 11:00 AM ET.
X
X
XGame 13 Adjournment Update
XA draw was agreed upon before adjournement has resumed.]
X
X
END_OF_FILE
if test 7012 -ne `wc -c <'shortened.txt'`; then
    echo shar: \"'shortened.txt'\" unpacked with wrong size!
fi
# end of 'shortened.txt'
fi
echo shar: End of archive 1 \(of 3\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 3 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

--
Henry Thomas - IRISA 		 - E-mail: Henry.Thomas@irisa.fr 
Campus Universitaire de Beaulieu - Phone: (+33)99 36 20 00 +549  
35042 RENNES CEDEX FRANCE 	 - Fax: (+33)99 38 38 32 Telex: UNIRISA 950473F
Telex Atlas X400: /X121=842950473/@atlas.fr, Fax:/X121=200099383832/@atlas.fr
--
... Words, and the words of men, flicker and flutter and beat
Warning, sorrow and gain, salutations and mirth...		R. Kipling

exit 0 # Just in case...
-- 
Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD           UUCP:     uunet!sparky!kent
Phone:    (402) 291-8300         FAX:      (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.