X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=hachu.c;h=2b89d21981879c8afbfb53a4951182da5448559c;hb=73e38eee67d4adfe808694e23046c1a89c6d1a8f;hp=854c9e70f21a29e69831913783881271420cf672;hpb=58d3dab5dece27790b3229b7e75cc2427dbf2290;p=hachu.git diff --git a/hachu.c b/hachu.c index 854c9e7..2b89d21 100644 --- a/hachu.c +++ b/hachu.c @@ -2091,7 +2091,7 @@ MapFromScratch(attacks); postThinking--; repCnt = 0; tlim1 = tlim2 = 1e8; msp = 0; Search(-INF-1, INF+1, 0, 1, sup1 & ~PROMOTE, sup2); postThinking++; - listStart = retFirst; listEnd = retMSP; + listStart = retFirst; listEnd = msp = retMSP; } MOVE @@ -2116,7 +2116,7 @@ ParseMove (char *moveText) ret = f<> SQLEN & SQUARE)) break; // any null move matches @@@@ @@ -2157,7 +2157,7 @@ Highlight(char *coords) char b[BSIZE], buf[2000], *q; for(i=0; i>SQLEN & SQUARE)) { int t = moveStack[i] & SQUARE; @@ -2259,6 +2259,8 @@ printf("# setup done");fflush(stdout); fflush(stdout); // make sure everything is printed before we do something that might take time + if(listEnd == 0) ListMoves(); // always maintain a list of legal moves in root position + if(stm == engineSide) { // if it is the engine's turn to move, set it thinking, and let it move pboard(board); @@ -2285,6 +2287,7 @@ pboard(board); stm = MakeMove2(stm, move); // assumes MakeMove returns new side to move gameMove[moveNr++] = move; // remember game printf("move %s\n", MoveToText(move, 1)); + listEnd = 0; } } @@ -2341,29 +2344,13 @@ printf("in: %s\n", command); if(sscanf(inBuf+7, "Contempt=%d", &contemptFactor) == 1) continue; continue; } - if(!strcmp(command, "variant")) { - for(i=0; i<7; i++) { - sscanf(inBuf+8, "%s", command); - if(!strcmp(variants[i].name, command)) { - Init(curVarNr = i); stm = Setup2(NULL); break; - } - } - continue; - } if(!strcmp(command, "sd")) { sscanf(inBuf, "sd %d", &maxDepth); continue; } if(!strcmp(command, "st")) { sscanf(inBuf, "st %d", &timePerMove); continue; } if(!strcmp(command, "memory")) { SetMemorySize(atoi(inBuf+7)); continue; } if(!strcmp(command, "ping")) { printf("pong%s", inBuf+4); continue; } // if(!strcmp(command, "")) { sscanf(inBuf, " %d", &); continue; } - if(!strcmp(command, "new")) { - engineSide = BLACK; Init(V_CHESS); stm = Setup2(NULL); maxDepth = MAXPLY; randomize = OFF; curVarNr = comp = 0; - continue; - } - if(!strcmp(command, "setboard")){ engineSide = NONE; Init(curVarNr); stm = Setup2(inBuf+9); continue; } if(!strcmp(command, "easy")) { ponder = OFF; continue; } if(!strcmp(command, "hard")) { ponder = ON; continue; } - if(!strcmp(command, "undo")) { stm = TakeBack(1); continue; } - if(!strcmp(command, "remove")) { stm = TakeBack(2); continue; } if(!strcmp(command, "go")) { engineSide = stm; continue; } if(!strcmp(command, "post")) { postThinking = ON; continue; } if(!strcmp(command, "nopost")) { postThinking = OFF;continue; } @@ -2386,7 +2373,7 @@ printf("in: %s\n", command); if(!strcmp(command, "accepted")){ continue; } if(!strcmp(command, "rejected")){ continue; } if(!strcmp(command, "result")) { continue; } - if(!strcmp(command, "hover")) { continue; } + if(!strcmp(command, "hover")) { continue; } if(!strcmp(command, "")) { continue; } if(!strcmp(command, "usermove")){ int move = ParseMove(inBuf+9); @@ -2396,11 +2383,28 @@ pboard(board); if(comp) PrintResult(stm, -INF); // against computer: claim } else { stm = MakeMove2(stm, move); - ponderMove = INVALID; + ponderMove = INVALID; listEnd = 0; gameMove[moveNr++] = move; // remember game } continue; } + listEnd = 0; + if(!strcmp(command, "new")) { + engineSide = BLACK; Init(V_CHESS); stm = Setup2(NULL); maxDepth = MAXPLY; randomize = OFF; curVarNr = comp = 0; + continue; + } + if(!strcmp(command, "variant")) { + for(i=0; i<7; i++) { + sscanf(inBuf+8, "%s", command); + if(!strcmp(variants[i].name, command)) { + Init(curVarNr = i); stm = Setup2(NULL); break; + } + } + continue; + } + if(!strcmp(command, "setboard")){ engineSide = NONE; Init(curVarNr); stm = Setup2(inBuf+9); continue; } + if(!strcmp(command, "undo")) { stm = TakeBack(1); continue; } + if(!strcmp(command, "remove")) { stm = TakeBack(2); continue; } printf("Error: unknown command\n"); } }