From: H.G. Muller Date: Thu, 9 Jun 2011 07:52:06 +0000 (+0200) Subject: version 1.4b27 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=0d182b4efac85dce968068bfe4509e52e9a30051;p=polyglot.git version 1.4b27 --- diff --git a/ChangeLog b/ChangeLog index dc5959b..5198de5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ -=========1.4b26=========== +=========1.4b27================ +- Option "ScoreWhite" : report score from white's point of view (suggested by E.M.). +- Option "KibitzInterval" : try to wait this many seconds between kibitzes (suggested by E.M.) +=========1.4b26================ - Contraction of version number. - Log if SetProcessAffinityMask is not available (suggested by E.M.). - pipe.cpp : Make PipeStruct a proper class with private/public members. diff --git a/Makefile.am b/Makefile.am index 85c63ce..251418c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -21,5 +21,5 @@ rpm: make dist rpmbuild -ta polyglot-@VERSION@.tar.gz -EXTRA_DIST=makefile.gcc polyglot.man polyglot.pod polyglot.spec debian/changelog debian/control debian/docs debian/README debian/compat debian/copyright debian/files debian/polyglot.substvars debian/rules +EXTRA_DIST=makefile.gcc makefile.ms polyglot.man polyglot.pod polyglot.spec debian/changelog debian/control debian/docs debian/README debian/compat debian/copyright debian/files debian/polyglot.substvars debian/rules diff --git a/Makefile.in b/Makefile.in index 702e4d5..0db7deb 100644 --- a/Makefile.in +++ b/Makefile.in @@ -196,7 +196,7 @@ top_srcdir = @top_srcdir@ polyglot_SOURCES = mainloop.cpp attack.cpp board.cpp book.cpp book_make.cpp book_merge.cpp colour.cpp engine.cpp epd.cpp fen.cpp gui.cpp game.cpp hash.cpp io.cpp line.cpp list.cpp main.cpp move.cpp move_do.cpp move_gen.cpp move_legal.cpp option.cpp parse.cpp pgn.cpp piece.cpp pipe.cpp posix.cpp random.cpp san.cpp search.cpp square.cpp uci.cpp uci2uci.cpp util.cpp xboard2uci.cpp mainloop.h colour.h hash.h move_gen.h piece.h uci2uci.h attack.h config.h gui.h io.h move.h pipe.h posix.h uci.h board.h engine.h line.h move_legal.h random.h util.h book.h epd.h list.h option.h san.h book_make.h fen.h main.h parse.h search.h book_merge.h game.h move_do.h pgn.h square.h xboard2uci.h dist_doc_DATA = README README1.3 README1.4 README1.4w README1.4w10UCI book_format.html man6_MANS = polyglot.man -EXTRA_DIST = makefile.gcc polyglot.man polyglot.pod polyglot.spec debian/changelog debian/control debian/docs debian/README debian/compat debian/copyright debian/files debian/polyglot.substvars debian/rules +EXTRA_DIST = makefile.gcc makefile.ms polyglot.man polyglot.pod polyglot.spec debian/changelog debian/control debian/docs debian/README debian/compat debian/copyright debian/files debian/polyglot.substvars debian/rules all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am diff --git a/README b/README index 7af6caf..0a147f9 100644 --- a/README +++ b/README @@ -324,6 +324,9 @@ CONFIG FILE FORMAT Show search information during engine pondering. Turning this off might be better for interactive use in some interfaces. + ScoreWhite (default: true) + Report score from white's point of view in xboard mode. + KibitzMove (default: false) Whether to kibitz when playing a move. @@ -340,6 +343,10 @@ CONFIG FILE FORMAT effect only if "KibitzPV" is selected, move kibitzes are always sent regardless of the delay. + KibitzInterval (default: 0) + This is another form of throttling. PolyGlot will usually wait this + many seconds before doing the next kibitz. + UCI (default: false) If true PolyGlot will not understand xboard commands. @@ -505,4 +512,4 @@ SEE ALSO - 2009-07-20 POLYGLOT(6) + 2009-07-26 POLYGLOT(6) diff --git a/config.h b/config.h index e00a8b5..9064aad 100644 --- a/config.h +++ b/config.h @@ -115,13 +115,13 @@ #define PACKAGE_NAME "polyglot" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "polyglot 1.4b26" +#define PACKAGE_STRING "polyglot 1.4b27" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "polyglot" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.4b26" +#define PACKAGE_VERSION "1.4b27" /* Define to 1 if the C compiler supports function prototypes. */ #define PROTOTYPES 1 @@ -150,7 +150,7 @@ #define TIME_WITH_SYS_TIME 1 /* Version number of package */ -#define VERSION "1.4b26" +#define VERSION "1.4b27" /* Define like PROTOTYPES; this can be used by system headers. */ #define __PROTOTYPES 1 diff --git a/configure b/configure index 752001a..a5adf30 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for polyglot 1.4b26. +# Generated by GNU Autoconf 2.61 for polyglot 1.4b27. # # Report bugs to . # @@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='polyglot' PACKAGE_TARNAME='polyglot' -PACKAGE_VERSION='1.4b26' -PACKAGE_STRING='polyglot 1.4b26' +PACKAGE_VERSION='1.4b27' +PACKAGE_STRING='polyglot 1.4b27' PACKAGE_BUGREPORT='michel.vandenbergh@uhasselt.be' ac_unique_file="mainloop.cpp" @@ -1216,7 +1216,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures polyglot 1.4b26 to adapt to many kinds of systems. +\`configure' configures polyglot 1.4b27 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1282,7 +1282,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of polyglot 1.4b26:";; + short | recursive ) echo "Configuration of polyglot 1.4b27:";; esac cat <<\_ACEOF @@ -1368,7 +1368,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -polyglot configure 1.4b26 +polyglot configure 1.4b27 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1382,7 +1382,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by polyglot $as_me 1.4b26, which was +It was created by polyglot $as_me 1.4b27, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -2072,7 +2072,7 @@ fi # Define the identity of the package. PACKAGE='polyglot' - VERSION='1.4b26' + VERSION='1.4b27' cat >>confdefs.h <<_ACEOF @@ -7344,7 +7344,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by polyglot $as_me 1.4b26, which was +This file was extended by polyglot $as_me 1.4b27, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7397,7 +7397,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -polyglot config.status 1.4b26 +polyglot config.status 1.4b27 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index 9cabff7..03d2aa1 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([polyglot], [1.4b26], [michel.vandenbergh@uhasselt.be]) +AC_INIT([polyglot], [1.4b27], [michel.vandenbergh@uhasselt.be]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([mainloop.cpp]) AC_CONFIG_HEADER([config.h]) diff --git a/main.cpp b/main.cpp index 4bd2fbb..9dd5e04 100644 --- a/main.cpp +++ b/main.cpp @@ -35,7 +35,7 @@ // constants -static const char * const Version = "1.4b26"; +static const char * const Version = "1.4b27"; static const char * const HelpMessage = "\ SYNTAX\n\ * polyglot [configfile]\n\ diff --git a/makefile.gcc b/makefile.gcc index 56ced5f..d432b9c 100644 --- a/makefile.gcc +++ b/makefile.gcc @@ -12,7 +12,7 @@ CYGL = -lmsvcrt CC = g++ DEFS = -DNDEBUG -OPTS = -Os -frename-registers -funit-at-a-time -fstrict-aliasing -fstrength-reduce +OPTS = -Os -frename-registers -funit-at-a-time -fstrict-aliasing -fstrength-reduce -fomit-frame-pointer CFLAGS = -Wall -pipe $(DEFS) $(OPTS) $(CYGF) LFLAGS = -fpic -s $(CYGF) LIBS = $(CYGL) diff --git a/makefile.ms b/makefile.ms new file mode 100644 index 0000000..1b3385b --- /dev/null +++ b/makefile.ms @@ -0,0 +1,57 @@ +PROJ = polyglot +EXE = $(PROJ).exe + +OBJS = attack.obj board.obj book.obj book_make.obj book_merge.obj colour.obj\ + engine.obj epd.obj fen.obj game.obj gui.obj hash.obj io.obj line.obj list.obj\ + main.obj mainloop.obj move.obj move_do.obj move_gen.obj move_legal.obj\ + option.obj parse.obj pgn.obj piece.obj pipe.obj posix.obj random.obj san.obj\ + search.obj square.obj uci.obj uci2uci.obj util.obj xboard2uci.obj + +LIBS = oldnames.lib + + +VCVER=6 +DEBUG=0 + + +# VC++ version +!if $(VCVER) >= 8 +CLIB = libcmt +LIBF = -MT +DEPRECATE=-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_USE_32BIT_TIME_T +!else +VSO = -Gf -Og +CLIB = msvcrt +LIBF = -MD +!endif + + +# Enable debugging? +!if $(DEBUG) == 0 +CFDEBUG = -DNDEBUG +OPTS = -Os -Oy -Gs -GA -Zl $(VSO) $(LIBF) +LFDEBUG = $(CLIB).lib +!else +CFDEBUG = -D_DEBUG -DDEBUG +OPTS = -Od -Zi -Fd$(PROJ).pdb $(LIBF)d +LFDEBUG = -DEBUG -PDB:$(PROJ).pdb -MAP:$(PROJ).map $(CLIB)d.lib +!endif + + +CC = @cl +LINK = link +#WARN = -W3 +DEFS = $(CFDEBUG) $(DEPRECATE) +CFLAGS = -c -nologo $(WARN) $(DEFS) $(OPTS) +LFLAGS = -nologo $(LFDEBUG) + +all: $(EXE) + +clean: + -erase $(OBJS) $(EXE) + +$(EXE): $(OBJS) + $(LINK) $(LFLAGS) $(OBJS) $(LIBS) -out:$(EXE) + +.cpp.obj: + $(CC) $(CFLAGS) -c $< diff --git a/option.cpp b/option.cpp index 979b715..a2e45ae 100644 --- a/option.cpp +++ b/option.cpp @@ -53,9 +53,11 @@ option_t Option[] = { { "KibitzPV", "check","0","0", "false" , NULL,0,NNB, PG|XBOARD}, { "KibitzCommand", "string","0","0", "tellall" , NULL,0,NNB, PG|XBOARD}, - { "KibitzDelay", "check","0","10000", "5" , NULL,0,NNB, PG|XBOARD}, + { "KibitzDelay", "spin","0","10000", "5" , NULL,0,NNB, PG|XBOARD}, + { "KibitzInterval", "spin","0","10000", "0" , NULL,0,NNB, PG|XBOARD}, { "ShowPonder", "check","0","0", "false" , NULL,0,NNB, PG|XBOARD}, + { "ScoreWhite", "check","0","0", "false" , NULL,0,NNB, PG|XBOARD}, // work-arounds diff --git a/polyglot.man b/polyglot.man index e97f815..9825303 100644 --- a/polyglot.man +++ b/polyglot.man @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "POLYGLOT 6" -.TH POLYGLOT 6 "2009-07-20" "" "" +.TH POLYGLOT 6 "2009-07-26" "" "" .SH "NAME" PolyGlot \- Winboard protocol to UCI protocol adapter \- book engine for Polyglot books @@ -441,6 +441,9 @@ This is the score in centipawns that will trigger resign \*(L"counting\*(R". .IX Item "ShowPonder (default: true)" Show search information during engine pondering. Turning this off might be better for interactive use in some interfaces. +.IP "\fBScoreWhite\fR (default: true)" 4 +.IX Item "ScoreWhite (default: true)" +Report score from white's point of view in xboard mode. .IP "\fBKibitzMove\fR (default: false)" 4 .IX Item "KibitzMove (default: false)" Whether to kibitz when playing a move. @@ -457,6 +460,10 @@ or \*(L"tellothers\*(R" for whispering. How many seconds to wait before starting kibitzing. This has an effect only if \*(L"KibitzPV\*(R" is selected, move kibitzes are always sent regardless of the delay. +.IP "\fBKibitzInterval\fR (default: 0)" 4 +.IX Item "KibitzInterval (default: 0)" +This is another form of throttling. PolyGlot will usually wait this +many seconds before doing the next kibitz. .IP "\fB\s-1UCI\s0\fR (default: false)" 4 .IX Item "UCI (default: false)" If true PolyGlot will not understand xboard commands. diff --git a/polyglot.pod b/polyglot.pod index be5d260..f7f066e 100644 --- a/polyglot.pod +++ b/polyglot.pod @@ -380,6 +380,10 @@ This is the score in centipawns that will trigger resign "counting". Show search information during engine pondering. Turning this off might be better for interactive use in some interfaces. +=item B (default: true) + +Report score from white's point of view in xboard mode. + =item B (default: false) Whether to kibitz when playing a move. @@ -393,13 +397,17 @@ Whether to kibitz when the PV is changed (new iteration or new best move). xboard command to use for kibitzing, normally "tellall" for kibitzing or "tellothers" for whispering. - =item B (default: 5) How many seconds to wait before starting kibitzing. This has an effect only if "KibitzPV" is selected, move kibitzes are always sent regardless of the delay. +=item B (default: 0) + +This is another form of throttling. PolyGlot will usually wait this +many seconds before doing the next kibitz. + =item B (default: false) If true PolyGlot will not understand xboard commands. diff --git a/polyglot.spec b/polyglot.spec index 04cb5f1..9d2a734 100644 --- a/polyglot.spec +++ b/polyglot.spec @@ -1,6 +1,6 @@ Summary: A Winboard protocol to UCI protocol adapter Name: polyglot -Version: 1.4b26 +Version: 1.4b27 Release: 1 License: GPL Group: Amusement/Games diff --git a/xboard2uci.cpp b/xboard2uci.cpp index 72e81e4..5ad952a 100644 --- a/xboard2uci.cpp +++ b/xboard2uci.cpp @@ -7,7 +7,7 @@ #include #include #include - +#include #include "board.h" #include "book.h" @@ -93,6 +93,8 @@ static void no_mess (int move); static void search_update (); static void search_clear (); static void update_remaining_time(); +static int report_best_score(); +static bool kibitz_throttle (bool searching); static void start_protected_command(); static void end_protected_command(); @@ -827,6 +829,16 @@ static void send_xboard_options(){ } +// report_best_score() + +static int report_best_score(){ + if(!option_get_bool("ScoreWhite") || colour_is_white(Uci->board->turn)){ + return Uci->best_score; + }else{ + return -Uci->best_score; + } +} + // comp_move() static void comp_move(int move) { @@ -1421,9 +1433,9 @@ static void send_pv() { line_to_san(Uci->best_pv,Uci->board,pv_string,StringSize); if(Uci->depth==-1) //hack to clear the engine output window - gui_send(GUI,"%d %+d %.0f "S64_FORMAT" ",0,Uci->best_score,Uci->time*100.0,Uci->node_nb); + gui_send(GUI,"%d %+d %.0f "S64_FORMAT" ",0,report_best_score(),Uci->time*100.0,Uci->node_nb); - gui_send(GUI,"%d %+d %.0f "S64_FORMAT" %s",Uci->best_depth,Uci->best_score,Uci->time*100.0,Uci->node_nb,pv_string); + gui_send(GUI,"%d %+d %.0f "S64_FORMAT" %s",Uci->best_depth,report_best_score(),Uci->time*100.0,Uci->node_nb,pv_string); } else if (State->state == PONDER && option_get_bool("ShowPonder")) { @@ -1433,7 +1445,7 @@ static void send_pv() { if (move != MoveNone && move_is_legal(move,board)) { move_to_san(move,board,move_string,256); line_to_san(Uci->best_pv,Uci->board,pv_string,StringSize); - gui_send(GUI,"%d %+d %.0f "S64_FORMAT" (%s) %s",Uci->best_depth,Uci->best_score,Uci->time*100.0,Uci->node_nb,move_string,pv_string); + gui_send(GUI,"%d %+d %.0f "S64_FORMAT" (%s) %s",Uci->best_depth,report_best_score(),Uci->time*100.0,Uci->node_nb,move_string,pv_string); } } } @@ -1446,8 +1458,9 @@ static void send_pv() { if (State->state == THINK || State->state == ANALYSE) { line_to_san(Uci->best_pv,Uci->board,pv_string,StringSize); - gui_send(GUI,"%s depth=%d time=%.2f node="S64_FORMAT" speed=%.0f score=%+.2f pv=\"%s\"",option_get_string("KibitzCommand"),Uci->best_depth,Uci->time,Uci->node_nb,Uci->speed,double(Uci->best_score)/100.0,pv_string); - + if(kibitz_throttle(Uci->searching)){ + gui_send(GUI,"%s depth=%d time=%.2f node="S64_FORMAT" speed=%.0f score=%+.2f pv=\"%s\"",option_get_string("KibitzCommand"),Uci->best_depth,Uci->time,Uci->node_nb,Uci->speed,double(report_best_score())/100.0,pv_string); + } } else if (State->state == PONDER) { game_get_board(Game,board); @@ -1456,12 +1469,36 @@ static void send_pv() { if (move != MoveNone && move_is_legal(move,board)) { move_to_san(move,board,move_string,256); line_to_san(Uci->best_pv,Uci->board,pv_string,StringSize); - gui_send(GUI,"%s depth=%d time=%.2f node="S64_FORMAT" speed=%.0f score=%+.2f pv=\"(%s) %s\"",option_get_string("KibitzCommand"),Uci->best_depth,Uci->time,Uci->node_nb,Uci->speed,double(Uci->best_score)/100.0,move_string,pv_string); + if(kibitz_throttle(Uci->searching)){ + gui_send(GUI,"%s depth=%d time=%.2f node="S64_FORMAT" speed=%.0f score=%+.2f pv=\"(%s) %s\"",option_get_string("KibitzCommand"),Uci->best_depth,Uci->time,Uci->node_nb,Uci->speed,double(report_best_score())/100.0,move_string,pv_string); + } } } } } +// kibitz_throttle() + +static bool kibitz_throttle(bool searching){ + time_t curr_time; + static time_t lastKibitzMove=0; + static time_t lastKibitzPV=0; + curr_time = time(NULL); + if(searching){ // KibitzPV + if(curr_time >= (option_get_int("KibitzInterval") + lastKibitzPV)){ + lastKibitzPV=curr_time; + return true; + } + }else{ // KibitzMove + if(curr_time >= (option_get_int("KibitzInterval") + lastKibitzMove)){ + lastKibitzPV=curr_time; + lastKibitzMove=curr_time; + return true; + } + } + return false; +} + // learn() static void learn(int result) {