Article View: gnu.chess
Article #4838gnuchess-4.0.pl71 changes: Makefile, gnuchess.h (long)
From: R. Bernstein
Date: Tue, 23 Aug 1994 16:25
Date: Tue, 23 Aug 1994 16:25
448 lines
15557 bytes
15557 bytes
At the end are edited diff's to some changes to the src/Makefile,and
src/gnuchess.h, and src/ttable.h.
I've made other minor changes which I will post separately.
Here are the justification for the changes.
* * * Makefile * * *
Change 1: Copyright date 1994 (sort of obvious)
Change 2: BOOKTYPE -> BOOKOPTS, Handling of book options
The rules for building the huge, big, med, and so on books are
almost the same except for the options supplied. So rather than
copy the rule 5 times changing the options, it is more robust to
set only the options and use a common rule. This is less error
prone should the rule change, which in fact is done below in Change 7.
Change 3: Pedantic accuracy
Change 4: Allowing compile-time table sizes to be passed to gnuchess.
A number of sizes are set in gnuchess.h that one might want to
change. Well actually, I needed to change these. Since there
already is this configuration section in the Makefile it may as well
include/describe these parameters too. It is easier to customize if
all user-settable things are in one place. But note that for this
change to have effect, a change to gnuchess.h must be made as well.
Change 5: adding HAVE_TIME_H
If ever gnuchess is converted to use autoconf. This variable should
be automatically set by that, and this is the default name autoconf uses.
Again for this to have effect, it a corresponding change to
gnuchess.h must be made.
Change 6: add INSTALL variable
On many Unix systems there is a install command which for example
can strip extraneous debug information before installing. So an
INSTALL variable was added and a suggesting to set to install is
commented. However the default remains cp. Again, if autoconf'd,
configure would set this properly.
Change 7: pedantic.
My Makefile had extraneous blanks in it. Emacs Makefile-mode warns
that there may be a problem.
Change 8: Common rule for making books, using INSTALL variable, test->check.
The common rule for making gnuchess.data was added, so as a side
benefit, one can make gnuchess.data separately. The rule changed a
bit: a dependency on gnuchess.bk1.z was added. Previously, the
gnuchess.data was always removed. Since building gnuchess.data can
take a long time, (perhaps even hours for larger books), I am not
sure why removing gnuchess.data this was desirable.
I've removed the remove statement. If there is something
I've missed, I suspect that there is a way to modify this rule
again (see the last sentence of Change 2) so that so that
*unnecessary* building is not done, but instead the make mechanism is used.
Installing is done via the INSTALL variable of Change 6.
Making the test cases has been automated a bit more. Some of the
instructions from test/README have been added as rules. Following
other GNU conventions, the rule name ``check'' is used; ``test'' is kept as
an alias for compatibility though. A rule ``bigcheck'' (using the name
found in flex and probably other GNU programs) has been added.
* * * gnuchess.h * * *
Change 1 & 2. Using HAVE_TIME_H which may be set in the Makefile
Change 3. Check to see if BOOKSIZE is defined such as via the Makefile or
by an argument passed to the C compiler. If so, respect it.
Here I would also suggest *removing* the test for
MSDOS and instead change the appropriate Makefiles to set
BOOKSIZE. Rather than test for operating systems, one should
test for features only. Maybe someday some MSDOS systems
will have a large enough address space?
I find these kinds of tests clutter the code. I believe the
code should be concerned with the algorithm and data structures,
not how the code is configured for specific machines. Therefore,
this is something that would be better delegated to something
like autoconf, or set as a Makefile parameter.
Change 4. Declaration of VMoveList. gcc -Wall reports this as being
implicitly defined in a number of C files.
* * * ttable.h * * *
Change 1. Check to see if ttblsz is defined such as via the Makefile or
by an argument passed to the C compiler. If so, respect it.
Following usual C conventions, shouldn't ttblsz be all caps?
See the CHANGE 3 note under gnuchess.h about a more robust and
cleaner way to set ttblsize for MSDOS.
*** Makefile Tue Aug 23 10:22:50 1994
--- Makefile-orig Tue May 10 10:00:53 1994
***************
*** 1,7 ****
#
# Makefile for GNU Chess
#
! # Copyright (c) 1992, 1994 Free Software Foundation
#
# This file is part of GNU CHESS.
#
--- 1,7 ----
#
# Makefile for GNU Chess
#
! # Copyright (c) 1992 Free Software Foundation
#
# This file is part of GNU CHESS.
#
***************
*** 35,60 ****
DIST= ../README ../README.lang ../doc ../misc ../src ../test
# size of book to make
! # Listed below are the book options and the size of the resulting book,
! # the default is small. Uncomment/comment the BOOKOPTS corresponding to
! # the size you want.
#
#huge 1,450K
- #BOOKOPTS='-S 188000 -P 26'
#big 540K
- #BOOKOPTS='-S 45000 -P 16'
#med 240K
- #BOOKOPTS='-S 20000 -P 12'
#small 144K
- BOOKOPTS='-S 12000 -P 10'
#tiny 78K
- #BOOKOPTS='-S 9000 -P 8'
# Distribution directory
DISTDIR= ../..
# Programs being distributed
! PROGS=gnuchess-4.0.pl71/src gnuchess-4.0.pl71/misc gnuchess-4.0.pl71/doc
LIBS = -lm
#LIBS = -lm /usr/ucblib/libucb.a #Solaris 2.3
--- 35,58 ----
DIST= ../README ../README.lang ../doc ../misc ../src ../test
# size of book to make
! # listed below are the book options and the size of the resulting book
#
+ # default is small
+ # set BOOKTYPE to the book you want
+ #
#huge 1,450K
#big 540K
#med 240K
#small 144K
#tiny 78K
+ BOOKTYPE=small
+
# Distribution directory
DISTDIR= ../..
# Programs being distributed
! PROGS=gnuchess-4.0/src gnuchess-4.0/misc gnuchess-4.0/doc
LIBS = -lm
#LIBS = -lm /usr/ucblib/libucb.a #Solaris 2.3
***************
*** 63,87 ****
# compile. Ask your system admin / unix guru to put gnuchess.{hash,lang,book}
# in $(LIBDIR).
# Where the binaries live.
#BINDIR= /usr/local/bin
#BINDIR= .
# Where language description, our book, and the persistent hash live.
LIBDIR= /usr/local/lib
#LIBDIR= .
# Display routines.
LCURSES=-lcurses -ltermcap
- # Table limits from gnuchess.h. These are given default values if not
- # set here. The default values are given below, but you may want to
- # check gnuchess.h to make sure.
- # -Dttblsz=150001 Transposition table size. Small address space computers
- # might try 8001. Setting ttblsz to 0 removes the transposition
- # table
- # -DBOOKSIZE=250000 Number of unique position/move combinations allowed.
- # For MSDOS 10000 is used.
-
#compile options for gnuchess
# -DBAREBONES compile for max speed no statistics etc kept
# -DQUIETBACKGROUND don't print post information in background ( easy OFF)
--- 61,76 ----
# compile. Ask your system admin / unix guru to put gnuchess.{hash,lang,book}
# in $(LIBDIR).
# Where the binaries live.
#BINDIR= /usr/local/bin
BINDIR= .
# Where language description, our book, and the persistent hash live.
#LIBDIR= /usr/local/lib
LIBDIR= .
# Display routines.
LCURSES=-lcurses -ltermcap
#compile options for gnuchess
# -DBAREBONES compile for max speed no statistics etc kept
# -DQUIETBACKGROUND don't print post information in background ( easy OFF)
***************
*** 93,99 ****
# -DHISTORY use history killer hueristic
# -DKILLT use killt killer hueristic
# -DHASGETTIMEOFDAY use gettimeofday for more accurate timing
- # -DHAVE_TIME_H have <time.h> header
# -DOLDTIME use old ply time estimating function
# -DCLIENT create client version for use with ICS
# -DOLDXBOARD don't generate underpromote moves
--- 82,87 ----
***************
*** 158,166 ****
# for their convenience and chess happiness.
LANGF= -DLANGFILE=\"$(LIBDIR)/gnuchess.lang\"
- INSTALL=cp
- #INSTALL=install -s
-
# The compiler used for compiling this software.
# Use this for a plain C compiler
#CC= cc $(OPT)
--- 145,150 ----
***************
*** 216,225 ****
game: game.c gnuchess.h
$(CC) $(CFLAGS) -o game game.c
!
postprint: postprint.o
$(CC) $(CFLAGS) $(HASH) -o postprint postprint.o
!
gnuan.o: gnuan.c gnuchess.h version.h
$(CC) $(CFLAGS) $(HASH) $(LANGF) $(BINBOOK) -c gnuan.c
--- 196,205 ----
game: game.c gnuchess.h
$(CC) $(CFLAGS) -o game game.c
!
postprint: postprint.o
$(CC) $(CFLAGS) $(HASH) -o postprint postprint.o
!
gnuan.o: gnuan.c gnuchess.h version.h
$(CC) $(CFLAGS) $(HASH) $(LANGF) $(BINBOOK) -c gnuan.c
***************
*** 379,418 ****
mv $$i $(DISTDIR)/GNU_Chess_$$i; \
done
! gnuchess.data: ../book/gnuchess.bk1.z
echo 3 0 >test;echo quit >>test
gzip -d -c ../book/gnuchess.bk1.z > /tmp/t
! cat test| ./gnuchessr -b /tmp/t -B ./gnuchess.data $(BOOKOPTS)
rm test /tmp/t
! install: install1 gnuchess.data
! -$(INSTALL) gnuchess.data $(LIBDIR)/gnuchess.data
! install1:
! -$(INSTALL) gnuchessx $(BINDIR)/gnuchessx
! -$(INSTALL) gnuchessc $(BINDIR)/gnuchessc
! -$(INSTALL) gnuchessr $(BINDIR)/gnuchessr
! -$(INSTALL) gnuchessn $(BINDIR)/gnuchessn
! -$(INSTALL) postprint $(BINDIR)/postprint
! -$(INSTALL) gnuan $(BINDIR)/gnuan
! -$(INSTALL) gnuchess $(BINDIR)/gnuchess
! -$(INSTALL) ../misc/gnuchess.lang $(LIBDIR)/gnuchess.lang
! test: check
! check: gnuchessr ../test/testall
! cat ../test/testall|gnuchessr > test.out 2>&1
! ../test/testall:
! (cd ../test; zcat test.tar.z | tar -xvf -)
!
! bigcheck: gnuchessr ../test/testall
! cat ../test/gnutest.run|gnuchessr > gnutest.out 2>&1
- ../test/gnutest.run:
- (cd ../test; zcat gnutest.tar.z | tar -xvf -)
clean:
! -rm -f gnuchessx gnuchessc gnuchess gnuchessr gnuchessn gnuchessd postprint gnuan game stamp-*
-echo $(DISTDIR)
-find $(DISTDIR) \( -name '*.o' -o -name '*~' -o -name 'CL*' -o -name 'PATCH*' -o -name '#*#' -o -name '%*%' -o -name '*orig' \) -exec rm -f {} \;
--- 359,417 ----
mv $$i $(DISTDIR)/GNU_Chess_$$i; \
done
! huge:
! -rm ./gnuchess.data
echo 3 0 >test;echo quit >>test
gzip -d -c ../book/gnuchess.bk1.z > /tmp/t
! cat test| ./gnuchessr -b /tmp/t -B ./gnuchess.data -S 188000 -P 26
rm test /tmp/t
! big:
! -rm ./gnuchess.data
! echo 3 0 >test;echo quit >>test
! gzip -d -c ../book/gnuchess.bk1.z > /tmp/t
! cat test| ./gnuchessr -b /tmp/t -B ./gnuchess.data -S 45000 -P 16
! rm test /tmp/t
+ med:
+ -rm ./gnuchess.data
+ echo 3 0 >test;echo quit >>test
+ gzip -d -c ../book/gnuchess.bk1.z > /tmp/t
+ cat test| ./gnuchessr -b /tmp/t -B ./gnuchess.data -S 20000 -P 12
+ rm test /tmp/t
! small:
! -rm ./gnuchess.data
! echo 3 0 >test;echo quit >>test
! gzip -d -c ../book/gnuchess.bk1.z > /tmp/t
! cat test| ./gnuchessr -b /tmp/t -B ./gnuchess.data -S 12000 -P 10
! rm test /tmp/t
! tiny:
! -rm ./gnuchess.data
! echo 3 0 >test;echo quit >>test
! gzip -d -c ../book/gnuchess.bk1.z > /tmp/t
! cat test| ./gnuchessr -b /tmp/t -B ./gnuchess.data -S 9000 -P 8
! rm test /tmp/t
! install: install1 $(BOOKTYPE)
! -cp ./gnuchess.data $(LIBDIR)/gnuchess.data
+ install1:
+ -cp gnuchessx $(BINDIR)/gnuchessx
+ -cp gnuchessc $(BINDIR)/gnuchessc
+ -cp gnuchessr $(BINDIR)/gnuchessr
+ -cp gnuchessn $(BINDIR)/gnuchessn
+ -cp postprint $(BINDIR)/postprint
+ -cp gnuan $(BINDIR)/gnuan
+ -cp gnuchess $(BINDIR)/gnuchess
+ -cp ../misc/gnuchess.lang $(LIBDIR)/gnuchess.lang
+
+ test: gnuchessr
+ cat ../test/testall|gnuchessr > test.out 2>&1
+
clean:
! -rm -f gnuchessx gnuchessc gnuchess gnuchessr gnuchessn gnuchessd postprint gnuan game
-echo $(DISTDIR)
-find $(DISTDIR) \( -name '*.o' -o -name '*~' -o -name 'CL*' -o -name 'PATCH*' -o -name '#*#' -o -name '%*%' -o -name '*orig' \) -exec rm -f {} \;
*** gnuchess.h Mon Aug 22 11:42:10 1994
--- gnuchess-orig.h Tue May 10 08:44:21 1994
***************
*** 69,75 ****
#include <stdlib.h>
#ifdef MSDOS
! #define HAVE_TIME_H
#include <malloc.h>
#define RWA_ACC "r+b"
#define WA_ACC "w+b"
--- 69,75 ----
#include <stdlib.h>
#ifdef MSDOS
! #include <time.h>
#include <malloc.h>
#define RWA_ACC "r+b"
#define WA_ACC "w+b"
***************
*** 95,104 ****
#endif
#endif /* MSDOS */
- #ifdef HAVE_TIME_H
- #include <time.h>
- #endif
-
#ifdef notdef
#if defined(__STDC__) || defined(MSDOS)
/* <stdio.h> */
--- 95,100 ----
***************
*** 212,224 ****
#define MAXMOVES 400 /* max number of half moves in a game */
#define NMOVELIMIT 20
#define XCLIMIT 5 /* number of different Time inputs */
- #ifndef BOOKSIZE
#if defined MSDOS
#define BOOKSIZE 10000 /* Number of unique position/move combinations allowed */
#else
#define BOOKSIZE 250000 /* Number of unique position/move combinations allowed */
#endif
- #endif
#define CPSIZE 235 /* size of lang file max */
#define DEFETABLE 18001 /* static eval cache */
/***************** tuning paramaters **********************************************/
--- 208,218 ----
***************
*** 552,558 ****
extern void ShowLine (UTSHORT *bstline);
extern int pick (SHORT p1, SHORT p2);
extern int VerifyMove (CHAR *s, SHORT inp, UTSHORT *mv);
- extern void VMoveList (SHORT side, register SHORT ply);
#if defined(GDX) && !defined(AMIGADOS)
extern struct gdxadmin B;
#endif
--- 546,551 ----
*** ttable-orig.h Fri May 20 23:50:41 1994
--- ttable.h Sun Aug 21 23:14:59 1994
***************
*** 4,14 ****
* ttblsz can be a any size. Setting ttblsz 0 removes the transposition
* tables.
*/
! #ifdef MSDOS
#define ttblsz 8001
#else
#define ttblsz 150001
#endif /* MSDOS */
#define MINTTABLE (8000) /* min ttable size -1 */
#define MAXrehash (7)
--- 4,17 ----
* ttblsz can be a any size. Setting ttblsz 0 removes the transposition
* tables.
*/
! #ifndef ttblsz
! #if defined(MSDOS)
#define ttblsz 8001
#else
#define ttblsz 150001
#endif /* MSDOS */
+ #endif /* ttblsz*/
+
#define MINTTABLE (8000) /* min ttable size -1 */
#define MAXrehash (7)
Technical Details
Message-ID:
<ROCKY.94Aug23122510@panix2.panix.com>Path:
arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!uunet!newsfeed.ACO.net!news.sztaki.hu!EU.net!howland.reston.ans.net!europa.eng.gtefsd.com!MathWorks.Com!panix!panix2.panix.com!rockyShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d71d,3834a75e49fb645d,start X-Google-Attributes: gid10d71d,public X-Google-ArrivalTime: 1994-08-23 12:48:46 PST Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!uunet!newsfeed.ACO.net!news.sztaki.hu!EU.net!howland.reston.ans.net!europa.eng.gtefsd.com!MathWorks.Com!panix!panix2.panix.com!rocky From: rocky@panix.com (R. Bernstein) Newsgroups: gnu.chess Subject: gnuchess-4.0.pl71 changes: Makefile, gnuchess.h (long) Date: 23 Aug 1994 12:25:13 -0400 Organization: PANIX Public Access Unix, NYC Lines: 448 Message-ID: <ROCKY.94Aug23122510@panix2.panix.com> Reply-To: rocky@panix.com NNTP-Posting-Host: panix2.panix.com Return-Receipt-to: rocky@panix.com