+=========1.4.37b================\r
+- Two new options: BookDepth and BookTreshold. BookDepth limits the number of moves the book is used and BookTreshold sets the minimum weight a book move should have.\r
=========1.4.36b================\r
- Bugfix: option = 0/1 was translated incorrectly.\r
- Default node count is 1.\r
Select moves according to their weights in the book. If false the
move with the highest weight is selected.
- BookLearn (default: false)
- Record learning information in the opening book. Naturally this
- requires the opening book to be writable.
+ BookRandom (default: true)
+ Select moves according to their weights in the book. If false the
+ move with the highest weight is selected.
+
+ BookDepth (default: 256)
+ Stop using the book after this number of moves.
+
+ BookTreshold (default: 5)
+ Do not play moves with a weight (probability) lower than this (in
+ per mil).
UseNice (default: false)
Run the engine at nice level 5, or "NiceValue" if it set. On some
only when necessary. Their purpose is to try to hide problems with
various software (not just engines).
- IMPORTANT: Any of these work arounds might be removed in future
- versions of PolyGlot. You are strongly recommended to contact the
- author of faulty software and truly fix the problem.
+ IMPORTANT: Any of these work arounds might be removed in future ver-
+ sions of PolyGlot. You are strongly recommended to contact the author
+ of faulty software and truly fix the problem.
PolyGlot supports the following work arounds:
- 2009-08-11 POLYGLOT(6)
+ 2009-08-13 POLYGLOT(6)
entry_t entry[1];\r
int move;\r
int score;\r
+ list_t list[1];\r
+ int i;\r
\r
if(BookFile==NULL) return MoveNone;\r
\r
ASSERT(board!=NULL);\r
ASSERT(random==TRUE||random==FALSE);\r
\r
+ // init\r
+ \r
+ list_clear(list);\r
+\r
+ book_moves(list,board);\r
\r
best_move = MoveNone;\r
best_score = 0;\r
- for (pos = find_pos(board->key); pos < BookSize; pos++) {\r
+ for(i=0; i<list_size(list); i++){\r
\r
- read_entry(entry,pos);\r
- if (entry->key != board->key) break;\r
-\r
- move = entry->move;\r
- score = entry->count;\r
+ move = list->move[i];\r
+ score = list->value[i];\r
\r
- if (move != MoveNone && move_is_legal(move,board)) {\r
+ if (move != MoveNone &&\r
+ move_is_legal(move,board) &&\r
+ score/10>option_get_int(Option,"BookTreshold")) {\r
\r
// pick this move?\r
\r
return best_move;\r
}\r
\r
-// book_disp()\r
+// book_moves()\r
\r
-void book_disp(const board_t * board) {\r
+void book_moves(list_t * list, const board_t * board) {\r
\r
int first_pos;\r
int sum;\r
char move_string[256];\r
\r
ASSERT(board!=NULL);\r
+ ASSERT(list!=NULL);\r
+\r
+ if(BookFile==NULL) return;\r
\r
- if(BookFile==NULL) return; \r
+ // init\r
+\r
+ list_clear(list);\r
\r
first_pos = find_pos(board->key);\r
\r
if (entry->key != board->key) break;\r
\r
move = entry->move;\r
- score = entry->count;\r
+ score = (entry->count*10000)/sum; // 32 bit safe!\r
\r
if (score > 0 && move != MoveNone && move_is_legal(move,board)) {\r
- move_to_san(move,board,move_string,256);\r
- printf(" %s (%.0f%%)\n",move_string,((double)score)/((double)sum)*100.0);\r
+ list_add_ex(list,move,score);\r
}\r
}\r
\r
- printf("\n");\r
+}\r
+\r
+\r
+// book_disp()\r
+\r
+void book_disp(const board_t * board) {\r
+\r
+ char move_string[256];\r
+ list_t list[1];\r
+ int i;\r
+\r
+ ASSERT(board!=NULL);\r
+\r
+ if(BookFile==NULL) return;\r
+\r
+ book_moves(list,board);\r
+ \r
+ for(i=0; i<list_size(list); i++){\r
+ move_to_san(list->move[i],board,move_string,256);\r
+ printf(" %6s %5.2f%%\n",move_string,list->value[i]/100.0);\r
+ }\r
}\r
\r
// book_learn_move()\r
\r
#include "board.h"\r
#include "util.h"\r
+#include "list.h"\r
\r
// functions\r
\r
\r
extern bool is_in_book (const board_t * board);\r
extern int book_move (const board_t * board, bool random);\r
+extern void book_moves (list_t * list, const board_t * board);\r
extern void book_disp (const board_t * board);\r
\r
extern void book_learn_move (const board_t * board, int move, int result);\r
#define PACKAGE_NAME "polyglot"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "polyglot 1.4.36b"
+#define PACKAGE_STRING "polyglot 1.4.37b"
/* 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.4.36b"
+#define PACKAGE_VERSION "1.4.37b"
/* Define to 1 if the C compiler supports function prototypes. */
#define PROTOTYPES 1
#define TIME_WITH_SYS_TIME 1
/* Version number of package */
-#define VERSION "1.4.36b"
+#define VERSION "1.4.37b"
/* Define like PROTOTYPES; this can be used by system headers. */
#define __PROTOTYPES 1
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for polyglot 1.4.36b.
+# Generated by GNU Autoconf 2.61 for polyglot 1.4.37b.
#
# Report bugs to <michel.vandenbergh@uhasselt.be>.
#
# Identity of this package.
PACKAGE_NAME='polyglot'
PACKAGE_TARNAME='polyglot'
-PACKAGE_VERSION='1.4.36b'
-PACKAGE_STRING='polyglot 1.4.36b'
+PACKAGE_VERSION='1.4.37b'
+PACKAGE_STRING='polyglot 1.4.37b'
PACKAGE_BUGREPORT='michel.vandenbergh@uhasselt.be'
ac_unique_file="mainloop.c"
# 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.4.36b to adapt to many kinds of systems.
+\`configure' configures polyglot 1.4.37b to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of polyglot 1.4.36b:";;
+ short | recursive ) echo "Configuration of polyglot 1.4.37b:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-polyglot configure 1.4.36b
+polyglot configure 1.4.37b
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
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.4.36b, which was
+It was created by polyglot $as_me 1.4.37b, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
# Define the identity of the package.
PACKAGE='polyglot'
- VERSION='1.4.36b'
+ VERSION='1.4.37b'
cat >>confdefs.h <<_ACEOF
# 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.4.36b, which was
+This file was extended by polyglot $as_me 1.4.37b, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-polyglot config.status 1.4.36b
+polyglot config.status 1.4.37b
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
-AC_INIT([polyglot], [1.4.36b], [michel.vandenbergh@uhasselt.be])
+AC_INIT([polyglot], [1.4.37b], [michel.vandenbergh@uhasselt.be])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([mainloop.c])
AC_CONFIG_HEADER([config.h])
ASSERT(io->out_fd>=0);
- my_log("Adapter>%s: EOF\n",io->name);
+ my_log("Adapter->%s: EOF\n",io->name);
if (close(io->out_fd) == -1) {
my_fatal("io_close(): close(): %s\n",strerror(errno));
// constants\r
\r
\r
-static const char * const Version = "1.4.36b";\r
+static const char * const Version = "1.4.37b";\r
static const char * const HelpMessage = "\\r
SYNTAX\n\\r
* polyglot [configfile]\n\\r
{ "EngineDir", "string","0","0", "." , NULL,0,NNB, PG}, \r
{ "EngineCommand", "string","0","0", "<empty>" , NULL,0,NNB, PG}, \r
\r
- { "Log", "check","0","0", "false" , NULL,0,NNB, PG|XBOARD|UCI}, \r
+ { "Log", "check","0","0", "false" , NULL,0,NNB, PG|XBOARD|UCI}, \r
{ "LogFile", "string","0","0", "polyglot.log", NULL,0,NNB, PG|XBOARD|UCI}, \r
\r
{ "UCI", "check","0","0", "false" , NULL,0,NNB, PG}, \r
{ "ResignMoves", "spin","0","10000", "3" , NULL,0,NNB, PG|XBOARD}, \r
{ "ResignScore", "spin","0","10000", "600" , NULL,0,NNB, PG|XBOARD}, \r
\r
- { "MateScore", "spin","0","1000000", "10000" , NULL,0,NNB, PG|XBOARD}, \r
+ { "MateScore", "spin","0","100000", "10000" , NULL,0,NNB, PG|XBOARD}, \r
\r
{ "Book", "check","0","0", "false" , NULL,0,NNB, PG|XBOARD|UCI}, \r
{ "BookFile", "string","0","0", "book.bin" , NULL,0,NNB, PG|XBOARD|UCI}, \r
\r
{ "BookRandom", "check","0","0", "true" , NULL,0,NNB, PG|XBOARD|UCI}, \r
+ { "BookDepth", "spin","0","256", "256" , NULL,0,NNB, PG|XBOARD}, \r
+ { "BookTreshold", "spin","0","1000", "5" , NULL,0,NNB, PG|XBOARD|UCI}, \r
{ "BookLearn", "check","0","0", "false" , NULL,0,NNB, PG|XBOARD}, \r
\r
{ "KibitzMove", "check","0","0", "false" , NULL,0,NNB, PG|XBOARD}, \r
{ "KibitzPV", "check","0","0", "false" , NULL,0,NNB, PG|XBOARD}, \r
\r
{ "KibitzCommand", "string","0","0", "tellall" , NULL,0,NNB, PG|XBOARD}, \r
- { "KibitzDelay", "spin","0","10000", "5" , NULL,0,NNB, PG|XBOARD}, \r
- { "KibitzInterval", "spin","0","10000", "0" , NULL,0,NNB, PG|XBOARD}, \r
+ { "KibitzDelay", "spin","0","1000", "5" , NULL,0,NNB, PG|XBOARD}, \r
+ { "KibitzInterval", "spin","0","1000", "0" , NULL,0,NNB, PG|XBOARD}, \r
\r
{ "ShowPonder", "check","0","0", "false" , NULL,0,NNB, PG|XBOARD}, \r
{ "ScoreWhite", "check","0","0", "false" , NULL,0,NNB, PG|XBOARD}, \r
{ "UCIVersion", "spin","1","2", "2" , NULL,0,NNB, PG|XBOARD}, \r
{ "CanPonder", "check","1","2", "false" , NULL,0,NNB, PG|XBOARD}, \r
{ "SyncStop", "check","1","2", "false" , NULL,0,NNB, PG|XBOARD}, \r
- { "Affinity", "spin","-1","32", "-1" , NULL,0,NNB, PG}, \r
- { "RepeatPV", "check","0","0", "true" , NULL,0,NNB, PG|XBOARD},\r
+ { "Affinity", "spin","-1","32", "-1" , NULL,0,NNB, PG}, \r
+ { "RepeatPV", "check","0","0", "true" , NULL,0,NNB, PG|XBOARD},\r
{ "PromoteWorkAround","check","0","0", "false" , NULL,0,NNB, PG|XBOARD}, \r
\r
- { "WbWorkArounds", "check","0","0", "true" , NULL,0,NNB, PG|XBOARD}, \r
+ { "WbWorkArounds", "check","0","0", "true" , NULL,0,NNB, PG|XBOARD}, \r
{ "WbWorkArounds2", "check","0","0", "false" , NULL,0,NNB, PG|XBOARD}, \r
{ NULL, NULL,"0","0", NULL , NULL,0,NNB, 0},\r
\r
.\" ========================================================================
.\"
.IX Title "POLYGLOT 6"
-.TH POLYGLOT 6 "2009-08-11" "" ""
+.TH POLYGLOT 6 "2009-08-13" "" ""
.SH "NAME"
PolyGlot \- Winboard protocol to UCI protocol adapter
\- book engine for Polyglot books
.IX Item "BookRandom (default: true)"
Select moves according to their weights in the book. If false the move
with the highest weight is selected.
-.IP "\fBBookLearn\fR (default: false)" 4
-.IX Item "BookLearn (default: false)"
-Record learning information in the opening book. Naturally this requires
-the opening book to be writable.
+.IP "\fBBookRandom\fR (default: true)" 4
+.IX Item "BookRandom (default: true)"
+Select moves according to their weights in the book. If false the move
+with the highest weight is selected.
+.IP "\fBBookDepth\fR (default: 256)" 4
+.IX Item "BookDepth (default: 256)"
+Stop using the book after this number of moves.
+.IP "\fBBookTreshold\fR (default: 5)" 4
+.IX Item "BookTreshold (default: 5)"
+Do not play moves with a weight (probability) lower than this (in per mil).
.IP "\fBUseNice\fR (default: false)" 4
.IX Item "UseNice (default: false)"
Run the engine at nice level 5, or \*(L"NiceValue\*(R" if it set. On some
Select moves according to their weights in the book. If false the move
with the highest weight is selected.
-=item B<BookLearn> (default: false)
+=item B<BookRandom> (default: true)
+
+Select moves according to their weights in the book. If false the move
+with the highest weight is selected.
+
+=item B<BookDepth> (default: 256)
+
+Stop using the book after this number of moves.
+
+=item B<BookTreshold> (default: 5)
-Record learning information in the opening book. Naturally this requires
-the opening book to be writable.
+Do not play moves with a weight (probability) lower than this (in per mil).
=item B<UseNice> (default: false)
Summary: A Winboard protocol to UCI protocol adapter
Name: polyglot
-Version: 1.4.36b
+Version: 1.4.37b
Release: 1
License: GPL
Group: Amusement/Games
\r
if (State->state == THINK || State->state == PONDER || State->state == ANALYSE) {\r
\r
+ // [VdB] moved up as we need the move number\r
+\r
+ game_get_board(Game,Uci->board);\r
+\r
// opening book\r
\r
- if (State->state == THINK && option_get_bool(Option,"Book")) {\r
+ if (State->state == THINK &&\r
+ option_get_bool(Option,"Book") &&\r
+ Uci->board->move_nb<option_get_int(Option,"BookDepth")\r
+ ) {\r
\r
- game_get_board(Game,Uci->board);\r
\r
move = book_move(Uci->board,option_get_bool(Option,"BookRandom"));\r
\r