X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=uci.c;h=2cd57e5b1d99f23af6815ba755150e1a52ae09b1;hb=learn;hp=eafefe40dc9edc30a0090f73efd9b64eb5ff63ad;hpb=50a1a4edffe8b24fa1b0e05ab46c004d757f2a74;p=polyglot.git diff --git a/uci.c b/uci.c index eafefe4..2cd57e5 100644 --- a/uci.c +++ b/uci.c @@ -130,7 +130,7 @@ void uci_open(uci_t * uci, engine_t * engine) { uci->engine = engine; uci->name = NULL; - my_string_set(&uci->name,""); + my_string_set(&uci->name,"unknown"); uci->author = NULL; my_string_set(&uci->author,""); option_init(uci->option); @@ -899,6 +899,8 @@ static void parse_score(uci_t * uci, const char string[]) { parse_add_keyword(parse,"mate"); parse_add_keyword(parse,"upperbound"); + uci->bound_type = '\0'; // [HGM] bound: assume exact score + // loop while (parse_get_word(parse,option,StringSize)) { @@ -921,6 +923,8 @@ static void parse_score(uci_t * uci, const char string[]) { ASSERT(my_string_empty(argument)); + uci->bound_type = '!'; + } else if (my_string_equal(option,"mate")) { ASSERT(!my_string_empty(argument)); @@ -934,6 +938,8 @@ static void parse_score(uci_t * uci, const char string[]) { ASSERT(my_string_empty(argument)); + uci->bound_type = '?'; + } else { my_log("POLYGLOT unknown option \"%s\" for command \"%s\"\n",option,command); @@ -947,13 +953,17 @@ static void parse_score(uci_t * uci, const char string[]) { static int mate_score(int dist) { + int ms = option_get_int(Option,"MateScore"); + ASSERT(dist!=0); if (FALSE) { + } else if (ms == 0) { + return (dist > 0 ? 100000 + dist : -100000 + dist); } else if (dist > 0) { - return +option_get_int(Option,"MateScore") - (+dist) * 2 + 1; + return +ms - (+dist) * 2 + 1; } else if (dist < 0) { - return -option_get_int(Option,"MateScore") + (-dist) * 2; + return -ms + (-dist) * 2; } return 0;