From a522b5e3c945c6b03810a870bc7016b0b6023c64 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Thu, 9 Jun 2011 10:09:13 +0200 Subject: [PATCH] version 1.4.51b --- ChangeLog | 2 + config.h | 6 ++-- configure | 20 +++++++------- configure.ac | 2 +- main.c | 2 +- polyglot.spec | 2 +- xboard2uci.c | 80 +++++++++++++++++++++++++++++++++++++++++++------------- 7 files changed, 79 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6495598..27ff52a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +=========1.4.51b================ +- Support for new nps command. Code provided by Harm Geert Muller. =========1.4.50b================ - Change in architecture. Persistence is disabled. The user is required to push the "Save" button explicitly to save the settings. What is retained is that in case PG is invoked with -noini (or as a special exception for WB 4.4.0 when the config files are polyglot_1st.ini or polyglot_2nd.ini) then PG uses a default config file whose name is derived from the engine name. - New option: OnlyWbOptions (default: true). Restrict the options that PG sends to those that are potentially useful for WinBoard. diff --git a/config.h b/config.h index d80095b..0e9e6d5 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.4.50b" +#define PACKAGE_STRING "polyglot 1.4.51b" /* 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.50b" +#define PACKAGE_VERSION "1.4.51b" /* 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.4.50b" +#define VERSION "1.4.51b" /* Define like PROTOTYPES; this can be used by system headers. */ #define __PROTOTYPES 1 diff --git a/configure b/configure index b5b969a..21b72a6 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.4.50b. +# Generated by GNU Autoconf 2.61 for polyglot 1.4.51b. # # 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.4.50b' -PACKAGE_STRING='polyglot 1.4.50b' +PACKAGE_VERSION='1.4.51b' +PACKAGE_STRING='polyglot 1.4.51b' PACKAGE_BUGREPORT='michel.vandenbergh@uhasselt.be' ac_unique_file="mainloop.c" @@ -1207,7 +1207,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.4.50b to adapt to many kinds of systems. +\`configure' configures polyglot 1.4.51b to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1273,7 +1273,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of polyglot 1.4.50b:";; + short | recursive ) echo "Configuration of polyglot 1.4.51b:";; esac cat <<\_ACEOF @@ -1357,7 +1357,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -polyglot configure 1.4.50b +polyglot configure 1.4.51b generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1371,7 +1371,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.4.50b, which was +It was created by polyglot $as_me 1.4.51b, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -2061,7 +2061,7 @@ fi # Define the identity of the package. PACKAGE='polyglot' - VERSION='1.4.50b' + VERSION='1.4.51b' cat >>confdefs.h <<_ACEOF @@ -6848,7 +6848,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.4.50b, which was +This file was extended by polyglot $as_me 1.4.51b, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6901,7 +6901,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -polyglot config.status 1.4.50b +polyglot config.status 1.4.51b 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 2ad1c89..c323079 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.4.50b], [michel.vandenbergh@uhasselt.be]) +AC_INIT([polyglot], [1.4.51b], [michel.vandenbergh@uhasselt.be]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([mainloop.c]) AC_CONFIG_HEADER([config.h]) diff --git a/main.c b/main.c index 830dfa2..60b1c5d 100644 --- a/main.c +++ b/main.c @@ -39,7 +39,7 @@ // constants -static const char * const Version = "1.4.50b"; +static const char * const Version = "1.4.51b"; static const char * const HelpMessage = "\ SYNTAX\n\ * polyglot [configfile] [-noini] [-ec engine] [-ed enginedirectory] [-en enginename] [-log] [-lf logfile] [-hash value] [-bk book] [-pg =]* [-uci =]*\n\ diff --git a/polyglot.spec b/polyglot.spec index 6e5d7f4..45f71b1 100644 --- a/polyglot.spec +++ b/polyglot.spec @@ -1,6 +1,6 @@ Summary: A Winboard protocol to UCI protocol adapter Name: polyglot -Version: 1.4.50b +Version: 1.4.51b Release: 1 License: GPL Group: Amusement/Games diff --git a/xboard2uci.c b/xboard2uci.c index e490906..c8c8354 100644 --- a/xboard2uci.c +++ b/xboard2uci.c @@ -75,6 +75,8 @@ typedef struct { double my_time; double opp_time; + + int node_rate; } xb_t; typedef enum { WAIT, THINK, PONDER, ANALYSE } dummy_state_t; @@ -165,6 +167,8 @@ void xboard2uci_init() { XB->my_time = 300.0; XB->opp_time = 300.0; + + XB->node_rate = -1; } // xboard2uci_gui_step() @@ -320,6 +324,7 @@ void xboard2uci_gui_step(char string[]) { XB->result = FALSE; XB->depth_limit = FALSE; + XB->node_rate=-1; XB->computer = FALSE; my_string_set(&XB->name,""); @@ -356,7 +361,10 @@ void xboard2uci_gui_step(char string[]) { ASSERT(XB->ping==-1); gui_send(GUI,"pong %s",Star[0]); } - + } else if (match(string,"nps *")) { + + // fake WB play-by-nodes mode + XB->node_rate = atoi(Star[0]); } else if (match(string,"playother")) { State->computer[game_turn(Game)] = FALSE; @@ -837,6 +845,7 @@ static void send_xboard_options(){ gui_send(GUI,"feature sigterm=0"); gui_send(GUI,"feature time=1"); gui_send(GUI,"feature usermove=1"); + gui_send(GUI,"feature nps=1"); if (XB->has_feature_memory){ gui_send(GUI,"feature memory=1"); }else{ @@ -1281,30 +1290,63 @@ static void search_update() { if (XB->time_limit) { // fixed time per move - - engine_send_queue(Engine," movetime %.0f",XB->time_max*1000.0); + + if(XB->node_rate > 0){ + engine_send_queue(Engine, + " nodes %.0f", + XB->time_max*((double)XB->node_rate)); + }else{ + engine_send_queue(Engine, + " movetime %.0f", + XB->time_max*1000.0); + } } else { // time controls - if (colour_is_white(Uci->board->turn)) { - engine_send_queue(Engine," wtime %.0f btime %.0f",XB->my_time*1000.0,XB->opp_time*1000.0); - } else { - engine_send_queue(Engine," wtime %.0f btime %.0f",XB->opp_time*1000.0,XB->my_time*1000.0); - } - - if (XB->inc != 0.0) engine_send_queue(Engine," winc %.0f binc %.0f",XB->inc*1000.0,XB->inc*1000.0); - - if (XB->mps != 0) { - - move_nb = XB->mps - (Uci->board->move_nb % XB->mps); - ASSERT(move_nb>=1&&move_nb<=XB->mps); - - engine_send_queue(Engine," movestogo %d",move_nb); - } + if(XB->node_rate > 0) { + double time; + move_nb = 40; + if (XB->mps != 0){ + move_nb = XB->mps - (Uci->board->move_nb % XB->mps); + } + time = XB->my_time / move_nb; + if(XB->inc != 0){ + time += XB->inc; + } + if(time > XB->my_time){ + time = XB->my_time; + } + engine_send_queue(Engine, + " nodes %.0f", + time*XB->node_rate); + } else { + + if (colour_is_white(Uci->board->turn)) { + engine_send_queue(Engine, + " wtime %.0f btime %.0f", + XB->my_time*1000.0,XB->opp_time*1000.0); + } else { + engine_send_queue(Engine, + " wtime %.0f btime %.0f", + XB->opp_time*1000.0,XB->my_time*1000.0); + } + + if (XB->inc != 0.0){ + engine_send_queue(Engine, + " winc %.0f binc %.0f", + XB->inc*1000.0,XB->inc*1000.0); + } + if (XB->mps != 0) { + + move_nb = XB->mps - (Uci->board->move_nb % XB->mps); + ASSERT(move_nb>=1&&move_nb<=XB->mps); + + engine_send_queue(Engine," movestogo %d",move_nb); + } + } } - if (XB->depth_limit) engine_send_queue(Engine," depth %d",XB->depth_max); if (State->state == PONDER) engine_send_queue(Engine," ponder"); -- 1.7.0.4