X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=hachu.c;h=176039f10eb1292fdb165bfb1747d89eebfb7728;hb=135d8ffb60839a6863d423a8c383b996ed0c937b;hp=5b93431cb3a5c6498cbd5be18aa2dbc78388fc65;hpb=1f3a4bc931765ccd3638208ec7e41990e1c25fb0;p=hachu.git diff --git a/hachu.c b/hachu.c index 5b93431..176039f 100644 --- a/hachu.c +++ b/hachu.c @@ -8,11 +8,10 @@ // TODO: // in GenCapts we do not generate jumps of more than two squares yet -// Chu rules for Lion capture // promotions by pieces with Lion power stepping in & out the zone in same turn // promotion on capture -#define VERSION 0.0 +#define VERSION "0.1beta" //define PATH level==0 || level==1 && path[0] == 0x55893 #define PATH 0 @@ -34,10 +33,12 @@ } #endif -#define BW 24 -#define BH 12 -#define BSIZE BW*BH*2 -#define ZONE 4 +#define BW bWidth +#define BH bHeight +#define BHMAX 15 +#define BWMAX (2*BHMAX) +#define BSIZE BWMAX*BHMAX +#define ZONE zone #define ONE 0 @@ -46,7 +47,7 @@ #define EMPTY 0 #define EDGE (1<<11) #define TYPE (WHITE|BLACK|EDGE) -#define ABSENT 4095 +#define ABSENT 2047 #define INF 8000 #define NPIECES 2000 /* length of piece list */ @@ -82,16 +83,17 @@ typedef struct { } PieceDesc; typedef struct { - int from, to, piece, victim, new, booty, epSquare, epVictim, ep2Square, ep2Victim, savKeyL, savKeyH; + int from, to, piece, victim, new, booty, epSquare, epVictim, ep2Square, ep2Victim, revMoveCount, savKeyL, savKeyH; } UndoInfo; -int stm, xstm, hashKeyH, hashKeyL, framePtr, msp, nonCapts, rootEval, retMSP, retFirst, pvPtr, level, chuFlag=1; +int bWidth, bHeight, bsize, zone, currentVariant; +int stm, xstm, hashKeyH, hashKeyL, framePtr, msp, nonCapts, rootEval, retMSP, retFirst, pvPtr, level, cnt50, chuFlag=1; int nodes, startTime, tlim1, tlim2; -Move retMove, moveStack[10000], path[100], pv[1000]; +Move retMove, moveStack[10000], path[100], repStack[300], pv[1000]; #define X 36 /* slider */ -#define J -1 /* jump */ -#define N -2 /* Knight */ +#define N -1 /* Knight */ +#define J -2 /* jump */ #define D -3 /* linear double move */ #define T -4 /* linear triple move */ #define L -5 /* true Lion move */ @@ -268,7 +270,7 @@ char daiArray[] = "LN:STICSGKGSCI:STNL/:RV.:CS.:FL.:BT:DE:BT.:FL.:CS.:RV/.:VO.:A "r:fd:sm:vmb:dh:dk:fk:dk:dhb:vm:sm:fdr/.:vo.:ab.:ew:ph:ln:kn:ew.:ab.:vo./:rv.:cs.:fl.:bt:de:bt.:fl.:cs.:rv/ln:sticsgkgsci:stnl"; typedef struct { - int boardWidth, boardFiles, zoneDepth, boardRanks; // board sizes + int boardWidth, boardFiles, boardRanks, zoneDepth; // board sizes char *name; // WinBoard name char *array; // initial position } VariantDesc; @@ -409,26 +411,46 @@ typedef struct { char age; } HashEntry; // hash-table entry + // Some global variables that control your engine's behavior + int ponder; + int randomize; + int postThinking; + int resign; // engine-defined option + int contemptFactor; // likewise + int squareKey[BSIZE]; -int rawBoard[BSIZE + 11*BW + 6]; +int rawBoard[BSIZE + 11*BHMAX + 6]; //int attacks[2*BSIZE]; // attack map int attackMaps[200*BSIZE], *attacks = attackMaps; char distance[2*BSIZE]; // distance table char promoBoard[BSIZE]; signed char PST[2*BSIZE]; -#define board (rawBoard + 6*BW + 3) +#define board (rawBoard + 6*BHMAX + 3) #define dist (distance + BSIZE) PieceDesc * -LookUp (char *name, PieceDesc *list) +ListLookUp (char *name, PieceDesc *list) { // find piece of given name in list of descriptors int i=0; while(list->name && strcmp(name, list->name)) i++, list++; return (list->name == NULL ? NULL : list); } +PieceDesc * +LookUp (char *name, int var) +{ // search piece of given name in all lists relevant for given variant + PieceDesc *desc; + switch(var) { + case 1: // Dai + desc = ListLookUp(name, daiPieces); + if(desc) return desc; + case 0: // Chu + return ListLookUp(name, chuPieces); + } +} + void SqueezeOut (int n) { // remove piece number n from the mentioned side's piece list (and adapt the reference to the displaced pieces!) @@ -521,8 +543,8 @@ AddPiece (int stm, PieceDesc *list) for(j=0; j<8; j++) p[i].range[j] = list->range[j^4*(WHITE-stm)]; switch(Range(p[i].range)) { case 1: p[i].pst = BH; break; - case 2: p[i].pst = BSIZE; break; - default: p[i].pst = BSIZE + BH; break; + case 2: p[i].pst = bsize; break; + default: p[i].pst = bsize + BH; break; } key = (stm == WHITE ? &list->whiteKey : &list->blackKey); if(!*key) *key = ~(myRandom()*myRandom()); @@ -537,7 +559,7 @@ AddPiece (int stm, PieceDesc *list) } void -SetUp(char *array, PieceDesc *list) +SetUp(char *array, int var) { int i, j, n, m, nr, color; char c, *q, name[3]; @@ -557,11 +579,11 @@ SetUp(char *array, PieceDesc *list) name[0] += 'A' - 'a'; if(name[1]) name[1] += 'A' - 'a'; } else color = WHITE; - p1 = LookUp(name, list); + p1 = LookUp(name, var); n = AddPiece(color, p1); p[n].pos = j; if(p1->promoted[0]) { - p2 = LookUp(p1->promoted, list); + p2 = LookUp(p1->promoted, var); m = AddPiece(color, p2); if(m <= n) n += 2; p[n].promo = m; @@ -588,10 +610,17 @@ int myRandom() } void -Init() +Init (int var) { int i, j, k; + currentVariant = var; + bWidth = variants[var].boardWidth; + bHeight = variants[var].boardRanks; + zone = variants[var].zoneDepth; + bsize = bWidth*bHeight; + chuFlag = (var == 0); + for(i= -1; i<9; i++) { // board steps in linear coordinates kStep[i] = STEP(direction[i&7].x, direction[i&7].y); // King nStep[i] = STEP(direction[(i&7)+8].x, direction[(i&7)+8].y); // Knight @@ -613,7 +642,7 @@ Init() } // fill distance table - for(i=0; i= -3) { // in any case, do a jump of 2 - if(board[x + 2*v] == EMPTY) - ADDMOVE(x, x+2*v); - if(r < -1) { // Lion power, also single step - if(board[x + v] == EMPTY) - ADDMOVE(x, x+v); - if(r == -3) { // true Lion, also Knight jump - v = nStep[j]; - if(board[x + v] == EMPTY) - ADDMOVE(x, x+v); - } - } - } - continue; - } - y = x; - while(r-- > 0) { - if(board[y+=v] == GUARD) break; // off board - if((board[y] + i & 1) == 0) break; // same color - } - } -} -#endif - int GenNonCapts (int promoSuppress) { @@ -761,13 +721,16 @@ GenNonCapts (int promoSuppress) for(i=stm+2; i<=last[stm]; i+=2) { int x = p[i].pos, pFlag = p[i].promoFlag; if(x == ABSENT) continue; - if(x == promoSuppress) pFlag = 0; + if(x == promoSuppress && chuFlag) pFlag = 0; for(j=0; j<8; j++) { int y, v = kStep[j], r = p[i].range[j]; if(r < 0) { // jumping piece, special treatment + if(r == N) { // pure Knightm do off-ray jump + NewNonCapture(x, x + nStep[j], pFlag); + } else if(r >= S) { // in any case, do a jump of 2 NewNonCapture(x, x + 2*v, pFlag); - if(r < N) { // Lion power, also single step + if(r < J) { // Lion power, also single step if(!NewNonCapture(x, x + v, pFlag)) nullMove = x; if(r == L) { // true Lion, also Knight jump v = nStep[j]; @@ -799,6 +762,11 @@ MapOneColor (int start, int last, int *map) for(j=0; j<8; j++) { int x = p[i].pos, v = kStep[j], r = p[i].range[j]; if(r < 0) { // jumping piece, special treatment + if(r == N) { + x += nStep[j]; + if(board[x] != EMPTY && board[x] != EDGE) + map[2*x + start] += one[8]; + } else if(r >= S) { // in any case, do a jump of 2 if(board[x + 2*v] != EMPTY && board[x + 2*v] != EDGE) map[2*(x + 2*v) + start] += one[j]; @@ -843,15 +811,15 @@ void MapFromScratch (int *map) { int i; - for(i=0; i<2*BSIZE; i++) map[i] = 0; + for(i=0; i<2*bsize; i++) map[i] = 0; MapOneColor(0, last[BLACK], map); MapOneColor(1, last[WHITE], map); } void Connect (int sqr, int piece, int dir) -{ - int x, step = kStep[dir], r1 = p[piece].range[dir], r2 = p[piece].range[dir+1], piece1, piece2; +{ // scan to both sides along ray to elongate attacks from there, and remove our own attacks on there, if needed + int x, step = kStep[dir], r1 = p[piece].range[dir], r2 = p[piece].range[dir+4], piece1, piece2; int d1, d2, r, y, c; if((attacks[2*sqr] + attacks[2*sqr+1]) & attackMask[dir]) { // there are incoming attack(s) from 'behind' @@ -870,15 +838,17 @@ Connect (int sqr, int piece, int dir) attacks[2*y + (piece1 & WHITE)] += one[dir]; // count attack UPDATE_MOBILITY(piece1, d2); } else UPDATE_MOBILITY(piece1, r1 - d1); // does not connect, but could still gain mobility - if(d1 + d2 <= (r2 = p[piece2].range[dir])) { // 2 hits 1 + if(d1 + d2 <= (r2 = p[piece2].range[dir+4])) { // 2 hits 1 attacks[2*x + (piece2 & WHITE)] += one[dir+4]; // count attack UPDATE_MOBILITY(piece2, d1); } else UPDATE_MOBILITY(piece2, r2 - d2); // does not connect, but could still gain mobility + // if r1 or r2<0, moves typically jump, and thus cannot be unblocked. Exceptions are FF and BS distant moves. + // test for d1+d2 > 2 && rN == F && d== 3 or rN == S } else { // we were only attacked from behind r = (r2 = p[piece1].range[dir]) - d1; - if(r < 0 || c > one[dir+1]) { // Oops! This was not our attacker, or not the only one. There must be a jump attack from even further behind! + if(r < 0 || c > one[dir+4]) { // Oops! This was not our attacker, or not the only one. There must be a jump attack from even further behind! // for now, forget jumpers } y = sqr; @@ -894,7 +864,7 @@ Connect (int sqr, int piece, int dir) } // we hit nothing with the extended move of the attacker behind us. UPDATE_MOBILITY(piece1, r2 - d1); - r = r1 - r2; // extra squares covered by mover + r = r1 - r2 + d1; // extra squares covered by mover while(r-- > 0) if(board[y+=step] != EMPTY) { d2 = dist[y-sqr]; piece2 = board[y]; @@ -904,6 +874,7 @@ Connect (int sqr, int piece, int dir) return; } } + // if r2<0 we should again test for F and S moves } else // no incoming attack from behind if(c = (attacks[2*sqr] + attacks[2*sqr+1]) & attackMask[dir+4]) { // but incoming attack(s) from 'ahead' @@ -928,7 +899,7 @@ Connect (int sqr, int piece, int dir) } // we hit nothing with the extended move of the attacker behind us. UPDATE_MOBILITY(piece2, r2 - d1); - r = r2 - r1; // extra squares covered by mover + r = r2 - r1 + d2; // extra squares covered by mover while(r-- > 0) if(board[x-=step] != EMPTY) { d1 = dist[x-sqr]; piece1 = board[x]; @@ -957,25 +928,64 @@ Connect (int sqr, int piece, int dir) } } +inline int +Hit (int r, int d) +{ // test if move with range r reaches over (un-obstructed) distance d + if(r < 0) switch(r) { + case J: return (d == 2); + case D: + case L: return (d <= 2); + case T: + case F: return (d <= 3); + case S: return 1; + default: return 0; + } else return (d <= r); + return 0; // not reached +} + void -Disconnect (int sqr, int dir) +Disconnect (int sqr, int piece, int dir) { - int x = sqr, step = kStep[dir], piece1, piece2, y; + int x = sqr, step = kStep[dir], piece1, piece2, d1, d2, r1, r2, y; while( board[x+=step] == EMPTY ); - if(board[x] != EDGE) { // x has hit a piece - piece1 = board[x]; + piece1 = board[x]; + if(piece1 != EDGE) { // x has hit a piece + d1 = dist[x-sqr]; + r1 = p[piece1].range[dir+4]; y = sqr; while( board[y-=step] == EMPTY ); - if(board[y] != EDGE) { // both ends of the ray hit a piece - piece2 = board[y]; - + piece2 = board[y]; + if(piece2 != EDGE) { // both ends of the ray hit a piece + d2 = dist[y-sqr]; + r2 = p[piece2].range[dir]; + if(r1 >= d1) { // piece1 hits us + attacks[2*sqr + (piece1 & WHITE)] += one[dir+4]; + if(r1 >= d1 + d2) // was hitting piece2 before, now blocked + attacks[2*y + (piece1 & WHITE)] -= one[dir+4]; + } + if(r2 >= d2) { // piece2 hits us + attacks[2*sqr + (piece2 & WHITE)] += one[dir]; + if(r2 >= d1 + d2) // was hitting piece1 before, now blocked + attacks[2*x + (piece2 & WHITE)] -= one[dir]; + } + if( Hit(p[piece].range[dir], d1) ) + attacks[2*sqr + stm] += one[dir]; + if( Hit(p[piece].range[dir+4], d2) ) + attacks[2*sqr + stm] += one[dir+4]; return; } } else { x = sqr; while( board[x-=step] == EMPTY ); - if(board[x] == EDGE) return; // ray empty on both sides + piece1 = board[x]; + if(piece1 == EDGE) return; // ray empty on both sides + d1 = dist[x-sqr]; + r1 = p[piece1].range[dir]; + dir += 4; } - // we only get here if one side hits a - + // we only get here if one side looks to the board edge + if(r1 >= d1) // piece1 hits us + attacks[2*sqr + (piece1 & WHITE)] += one[dir^4]; + if( Hit(p[piece].range[dir], d1) ) + attacks[2*sqr + stm] += one[dir]; } void @@ -983,7 +993,7 @@ Occupy (int sqr) { // determines attacks on square and blocking when a piece lands on an empty square int i; for(i=0; i<4; i++) { - Disconnect(sqr, i); + Disconnect(sqr, board[sqr], i); } } @@ -1004,6 +1014,7 @@ MakeMove(Move m, UndoInfo *u) u->piece = board[u->from]; board[u->from] = EMPTY; u->booty = 0; + u->revMoveCount = cnt50++; u->savKeyL = hashKeyL; u->savKeyH = hashKeyH; @@ -1015,6 +1026,7 @@ MakeMove(Move m, UndoInfo *u) p[u->piece].pos = ABSENT; u->new = p[u->piece].promo; u->booty = p[u->new].value - p[u->piece].value; + cnt50 = 0; // promotion irreversible } } else u->new = u->piece; @@ -1040,12 +1052,13 @@ MakeMove(Move m, UndoInfo *u) hashKeyL ^= p[u->ep2Victim].pieceKey * squareKey[u->ep2Square]; hashKeyH ^= p[u->ep2Victim].pieceKey * squareKey[u->ep2Square+BH]; if(p[u->piece].value != 1000 && p[u->epVictim].value == 1000) deferred |= PROMOTE; // flag non-Lion x Lion + cnt50 = 0; // double capture irreversible } else u->epVictim = EMPTY; u->victim = board[u->to]; p[u->victim].pos = ABSENT; u->booty += p[u->victim].value + PST[p[u->victim].pst + u->to]; -// if(p[u->victim].value == 1000 && p[u->piece].value != 1000) deferred |= PROMOTE; // flag non-Lion x Lion + if(u->victim != EMPTY) cnt50 = 0; // capture irreversible p[u->new].pos = u->to; board[u->to] = u->new; @@ -1077,6 +1090,7 @@ UnMake(UndoInfo *u) p[u->piece].pos = u->from; // this can be the same as above board[u->from] = u->piece; + cnt50 = u->revMoveCount; hashKeyL = u->savKeyL; hashKeyH = u->savKeyH; } @@ -1285,6 +1299,11 @@ if(flag && depth>= 0) printf("phase=%d: first/curr/last = %d / %d / %d\n", phase break; case 7: // bad captures case 8: // PV null move + phase = 9; + if(nullMove != ABSENT) { + moveStack[msp++] = nullMove + (nullMove << SQLEN) | DEFER; // kludge: setting DEFER guarantees != 0, and has no effect + } +printf("# %d. sqr = %08x null = %08x\n", msp, nullMove, moveStack[msp-1]); case 9: goto cutoff; } @@ -1304,11 +1323,19 @@ if(flag & depth >= 0) printf("%2d:%d extract %d/%d\n", depth, iterDep, curMove, if(move == 0) continue; // skip invalidated move } if(flag & depth >= 0) printf("%2d:%d found %d/%d\n", depth, iterDep, curMove, msp); + // RECURSION stm ^= WHITE; - defer = MakeMove(moveStack[curMove], &tb); -path[level++] = moveStack[curMove]; -attacks += 2*BSIZE; + defer = MakeMove(move, &tb); + + for(i=2; i<=cnt50; i+=2) if(repStack[level-i+200] == hashKeyH) { + moveStack[curMove] = 0; // erase forbidden move + score = -INF; goto repetition; + } + repStack[level+200] = hashKeyH; + +path[level++] = move; +attacks += 2*bsize; MapFromScratch(attacks); // for as long as incremental update does not work. if(PATH) pmap(attacks, stm); if(chuFlag && p[tb.victim].value == 1000) { // verify legality of Lion capture in Chu Shogi @@ -1320,7 +1347,7 @@ if(PATH) pmap(attacks, stm); if(promoSuppress & PROMOTE) score = -INF; // non-Lion captures Lion after opponent did same defer |= PROMOTE; // if we started, flag he cannot do it in reply } - if(score == -INF) { moveStack[curMove] = 0; goto abortMove; } + if(score == -INF) { moveStack[curMove] = 0; goto abortMove; } // zap illegal moves } #if 1 score = -Search(-beta, -iterAlpha, -difEval - tb.booty, replyDep, promoSuppress & ~PROMOTE, defer); @@ -1328,14 +1355,14 @@ if(PATH) pmap(attacks, stm); score = 0; #endif abortMove: - - -attacks -= 2*BSIZE; +attacks -= 2*bsize; level--; + repetition: UnMake(&tb); xstm = stm; stm ^= WHITE; #if 1 if(PATH) printf("%d:%2d:%d %3d %6x %-10s %6d %6d\n", level, depth, iterDep, curMove, moveStack[curMove], MoveToText(moveStack[curMove], 0), score, bestScore); + // ALPHA-BETA STUFF if(score > bestScore) { bestScore = score; bestMoveNr = curMove; @@ -1367,6 +1394,12 @@ if(PATH) printf("%d:%2d:%d %3d %6x %-10s %6d %6d\n", level, depth, iterDep, curM } // next move cutoff: if(!level) { // root node + if(postThinking > 0) { + int i; // WB thinking output + printf("%d %d %d %d", iterDep, bestScore, (GetTickCount() - startTime)/10, nodes); + for(i=0; pv[i]; i++) printf(" %s", MoveToText(pv[i], 0)); + printf("\n"); fflush(stdout); + } if(GetTickCount() - startTime > tlim1) break; // do not start iteration we can (most likely) not finish } replyDep = iterDep; @@ -1482,26 +1515,32 @@ int lastLift, lastPut; int MakeMove2 (int stm, MOVE move) { + int i; sup0 = sup1; sup1 = sup2; sup2 = MakeMove(move, &undoInfo); rootEval = -rootEval - undoInfo.booty; + for(i=0; i<200; i++) repStack[i] = repStack[i+1]; + repStack[199] = hashKeyH; +printf("# makemove %08x %c%d %c%d\n", move, sup1%BW+'a', sup1/BW, sup2%BW+'a', sup2/BW); return stm ^ WHITE; } void UnMake2 (MOVE move) { + int i; rootEval = -rootEval - undoInfo.booty; UnMake(&undoInfo); + for(i=200; i>0; i--) repStack[i] = repStack[i-1]; sup2 = sup1; sup1 = sup0; } int Setup2 (char *fen) { - SetUp(chuArray, chuPieces); + SetUp(variants[currentVariant].array, currentVariant); sup0 = sup1 = sup2 = ABSENT; - rootEval = hashKeyH = hashKeyL = 0; + rootEval = cnt50 = hashKeyH = hashKeyL = 0; return WHITE; } @@ -1515,6 +1554,7 @@ MoveToText (MOVE move, int multiLine) { static char buf[50]; int f = move>>SQLEN & SQUARE, g = f, t = move & SQUARE; + if(f == t) { sprintf(buf, "@@@@"); return buf; } // null-move notation in WB protocol buf[0] = '\0'; if(t >= SPECIAL) { // kludgy! Print as side effect non-standard WB command to remove victims from double-capture (breaks hint command!) int e = f + epList[t - SPECIAL]; @@ -1547,6 +1587,7 @@ MOVE ParseMove (char *moveText) { int i, j, f, t, t2, e, ret, deferred=0; + char c = moveText[0]; moveText += ReadSquare(moveText, &f); moveText += ReadSquare(moveText, &t); t2 = t; if(*moveText == ',') { @@ -1563,9 +1604,14 @@ ParseMove (char *moveText) } ret = f<> SQLEN & SQUARE)) break; // any null move matches @@@@ if((moveStack[i] & (PROMOTE | DEFER-1)) == ret) break; if((moveStack[i] & DEFER-1) == ret) deferred = i; // promoted version of entered non-promotion is legal } @@ -1591,11 +1637,13 @@ Highlight(char *coords) { int i, j, n, sqr, cnt=0; char b[BSIZE], buf[2000], *q; - for(i=0; i>SQLEN & SQUARE)) { @@ -1644,10 +1692,10 @@ SearchBestMove (int stm, int timeLeft, int mps, int timeControl, int inc, int ti { int score, targetTime, movesLeft = 50; if(mps) movesLeft = mps - (moveNr>>1)%mps; - targetTime = timeLeft*10 / (movesLeft + 1) + 1000 * inc; + targetTime = timeLeft*10 / (movesLeft + 2) + 1000 * inc; if(timePerMove > 0) targetTime = timeLeft * 5; startTime = GetTickCount(); - tlim1 = 0.3*targetTime; + tlim1 = 0.2*targetTime; tlim2 = 1.9*targetTime; nodes = 0; MapFromScratch(attacks); @@ -1662,13 +1710,6 @@ PonderUntilInput (int stm) { } - // Some global variables that control your engine's behavior - int ponder; - int randomize; - int postThinking; - int resign; // engine-defined option - int contemptFactor; // likewise - int TakeBack(int n) { // reset the game and then replay it to the desired point int last, stm; @@ -1696,8 +1737,8 @@ printf("# setup done");fflush(stdout); int i, score; char inBuf[8000], command[80]; - Init(); - SetUp(chuArray, chuPieces); + Init(0); // Chu + SetUp(chuArray, 0); // pplist(); // pboard(board); // pbytes(promoBoard); @@ -1767,8 +1808,8 @@ printf("in: %s\n", command); } if(!strcmp(command, "protover")){ printf("feature ping=1 setboard=1 colors=0 usermove=1 memory=1 debug=1 sigint=0 sigterm=0\n"); - printf("feature variants=\"chu,12x12+0_fairy\"\n"); - printf("feature highlight=1\n"); + printf("feature variants=\"chu,dai,12x12+0_fairy\"\n"); + printf("feature myname=\"HaChu " VERSION "\" highlight=1\n"); printf("feature option=\"Resign -check 0\"\n"); // example of an engine-defined option printf("feature option=\"Contempt -spin 0 -200 200\"\n"); // and another one printf("feature done=1\n"); @@ -1779,6 +1820,15 @@ printf("in: %s\n", command); if(sscanf(inBuf+7, "Contempt=%d", &contemptFactor) == 1) continue; continue; } + if(!strcmp(command, "variant")) { + for(i=0; i<2; i++) { + sscanf(inBuf+8, "%s", command); + if(!strcmp(variants[i].name, command)) { + Init(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; } @@ -1798,7 +1848,6 @@ printf("in: %s\n", command); if(!strcmp(command, "lift")) { Highlight(inBuf+5); continue; } if(!strcmp(command, "put")) { ReadSquare(inBuf+4, &lastPut); continue; } if(!strcmp(command, "book")) { continue; } - if(!strcmp(command, "variant")) { continue; } // non-standard commands if(!strcmp(command, "p")) { pboard(board); continue; } if(!strcmp(command, "w")) { pmap(attacks, WHITE); continue; } @@ -1810,6 +1859,7 @@ printf("in: %s\n", command); if(!strcmp(command, "ics")) { continue; } if(!strcmp(command, "accepted")){ continue; } if(!strcmp(command, "rejected")){ continue; } + if(!strcmp(command, "result")) { continue; } if(!strcmp(command, "hover")) { continue; } if(!strcmp(command, "")) { continue; } if(!strcmp(command, "usermove")){