From: H.G.Muller Date: Mon, 3 Mar 2014 13:37:46 +0000 (+0100) Subject: Implement analysis mode X-Git-Url: http://winboard.nl/cgi-bin?p=gnushogi.git;a=commitdiff_plain;h=dec345dc3b77affb98207d7387093dbdee39c08b Implement analysis mode The XBoard commands 'analyze' and 'exit' are recognized, to set and clear a new analysis flag (and set force mode). While the flag is set the input loop will order a background search on the current position while waiting for input. (Note that the 'exit' command outside XBoard mode is synonymous for 'quit'!) BEWARE: automatic updates interrupt the analysis. --- diff --git a/gnushogi/commondsp.c b/gnushogi/commondsp.c index 4718fd9..9556f63 100644 --- a/gnushogi/commondsp.c +++ b/gnushogi/commondsp.c @@ -1575,6 +1575,10 @@ InputCommand(char *command) { player = opponent; + if (flag.analyze) { + SelectMove(opponent, BACKGROUND_MODE); + } + #ifdef QUIETBACKGROUND if (!have_shown_prompt) { @@ -1636,7 +1640,7 @@ InputCommand(char *command) /* noop */ ; } else if ((strcmp(s, "quit") == 0) || - (strcmp(s, "exit") == 0)) + (strcmp(s, "exit") == 0) && !xboard) { flag.quit = true; } @@ -1665,6 +1669,19 @@ InputCommand(char *command) ); printf("debug=1 setboard=0 sigint=0 done=1\n"); } + else if (strcmp(s, ".") == 0) + { // ignore for now + } + else if (strcmp(s, "exit") == 0) + { + flag.analyze = false; + flag.force = true; + } + else if (strcmp(s, "analyze") == 0) + { + flag.analyze = true; + flag.force = true; + } else if ((strcmp(s, "set") == 0) || (strcmp(s, "edit") == 0)) { diff --git a/gnushogi/gnushogi.h b/gnushogi/gnushogi.h index 4e2b23e..0e3e0de 100644 --- a/gnushogi/gnushogi.h +++ b/gnushogi/gnushogi.h @@ -642,6 +642,7 @@ struct flags short bothsides; /* computer plays both sides */ short hash; /* enable/disable transposition table */ short force; /* enter moves */ + short analyze; /* search during move entry */ short easy; /* disable thinking on opponents time */ short beep; /* enable/disable beep */ short timeout; /* time to make a move */