X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=hachu.c;h=2d6334939a29171647f15a272d83ef647abd579b;hb=12ca3b5e2047513cecc01b46a4bb84b2189a117a;hp=0f612f48331edf237670a6004d448a0c489829e5;hpb=fb0a912d9567dfea7682e074f14fc0158b96f316;p=hachu.git diff --git a/hachu.c b/hachu.c index 0f612f4..2d63349 100644 --- a/hachu.c +++ b/hachu.c @@ -191,9 +191,7 @@ Move retMove, moveStack[20000], path[100], repStack[300], pv[1000], repeatMove[3 #define FVAL 5000 /* piece value of Fire Demon. Used in code for recognizing moves with it and do burns */ PieceDesc chuPieces[] = { - {"LN", "", LVAL, { W,W,W,W,W,W,W,W }, 4 }, // lion -// {"LN", "", LVAL, { T,T,T,T,T,T,T,T }, 4 }, // lion -// {"LN", "", LVAL, { L,L,L,L,L,L,L,L }, 4 }, // lion + {"LN", "", LVAL, { L,L,L,L,L,L,L,L }, 4 }, // lion {"FK", "", 600, { X,X,X,X,X,X,X,X }, 4 }, // free king {"SE", "", 550, { X,D,X,X,X,X,X,D }, 4 }, // soaring eagle {"HF", "", 500, { D,X,X,X,X,X,X,X }, 4 }, // horned falcon @@ -467,7 +465,7 @@ PieceDesc wolfPieces[] = { {"R", "", 500, { X,0,X,0,X,0,X,0 }, 3 }, {"B", "", 320, { 0,X,0,X,0,X,0,X }, 1 }, {"N", "", 300, { N,N,N,N,N,N,N,N }, 1 }, - {"K", "", 280, { 1,1,1,1,1,1,1,1 } }, + {"K", "", 280, { 1,1,1,1,1,1,1,1 }, 0, 4 }, {"P", "R", 80, { M,C,0,0,0,0,0,C } }, { NULL } // sentinel }; @@ -1456,11 +1454,12 @@ MakeMove(Move m, UndoInfo *u) u->victim = board[u->to]; p[u->victim].pos = ABSENT; - if(p[u->victim].ranking == 5 && p[u->piece].ranking != 4) { // contageous piece captured by non-royal + if(p[u->victim].ranking == 5 && p[u->piece].ranking < 4) { // contageous piece captured by non-royal + u->booty -= p[u->new].value; u->new = u->piece & 1 | 2; // promote to it - p[u->piece].pos = ABSENT; - u->booty += p[u->new].value - p[u->piece].value; if(p[u->new].pos != ABSENT) u->new += 2; + p[u->piece].pos = ABSENT; + u->booty += p[u->new].value; } u->booty += PST[p[u->new].pst + u->to] - PST[p[u->piece].pst + u->from]; @@ -1685,7 +1684,7 @@ GenCapts (int sqr, int victimValue) for(i=0; i<8; i++) { // scan all knight jumps to locate source int x = sqr - nStep[i], attacker = board[x]; if(attacker == EMPTY || (attacker & TYPE) != stm) continue; - if(p[attacker].range[i] <= L && p[attacker].range[i] >= S || p[attacker].range[i] == N) { // has Knight jump in our direction + if(p[attacker].range[i] == L || p[attacker].range[i] < W && p[attacker].range[i] >= S || p[attacker].range[i] == N) { // has Knight jump in our direction NewCapture(x, sqr + victimValue, p[attacker].promoFlag); // plain jump (as in N) if(p[attacker].range[i] < N) { // Lion power; generate double captures over two possible intermediates int v = kStep[i]; // leftish path @@ -1995,6 +1994,7 @@ if(PATH) printf("# probe hash index=%x hit=%d\n", index, hit),fflush(stdout); if(hit >= 0) { bestScore = hashTable[index].score[hit]; hashMove = hashTable[index].move[hit]; + if((bestScore <= alpha || hashTable[index].flag[hit] & H_LOWER) && (bestScore >= beta || hashTable[index].flag[hit] & H_UPPER) ) { iterDep = resDep = hashTable[index].depth[hit]; bestMoveNr = 0; @@ -2195,7 +2195,7 @@ attacks += 2*bsize; MapFromScratch(attacks); // for as long as incremental update does not work. //if(flag & depth >= 0) printf("%2d:%d mapped %d/%d %s\n", depth, iterDep, curMove, msp, MoveToText(moveStack[curMove], 0)); //if(PATH) pmap(attacks, stm); - if(chuFlag && p[tb.victim].value == LVAL) {// verify legality of Lion capture in Chu Shogi + if(chuFlag && (p[tb.victim].value == LVAL || p[tb.epVictim[0]].value == LVAL)) {// verify legality of Lion capture in Chu Shogi score = 0; if(p[tb.piece].value == LVAL) { // Ln x Ln: can make Ln 'vulnerable' (if distant and not through intemediate > GB) if(dist[tb.from-tb.to] != 1 && attacks[2*tb.to + stm] && p[tb.epVictim[0]].value <= 50) @@ -2549,7 +2549,7 @@ MoveToText (MOVE move, int multiLine) } t = g + toList[t - SPECIAL]; } - if(move & PROMOTE) promoChar = currentVariant == V_MAKRUK ? "m" : repDraws ? "q" : "+"; + if(move & PROMOTE) promoChar = currentVariant == V_MAKRUK ? "m" : currentVariant == V_WOLF ? "r" : repDraws ? "q" : "+"; sprintf(buf+strlen(buf), "%c%d%c%d%s", f%BW+'a', f/BW+ONE, t%BW+'a', t/BW+ONE, promoChar); return buf; } @@ -2582,7 +2582,7 @@ MapFromScratch(attacks); for(i=listStart; i> SQLEN & SQUARE; if(to >= SPECIAL) continue; - if(p[board[to]].ranking == 5 && p[board[from]].ranking != 4) moveStack[i] |= PROMOTE; + if(p[board[to]].ranking == 5 && p[board[from]].ranking < 4) moveStack[i] |= PROMOTE; } } @@ -2633,6 +2633,7 @@ ParseMove (char *moveText) if(t == f-2 && f > BW) t2 = CASTLE + 3; } ret = f<= listEnd) { @@ -2890,7 +2891,7 @@ pboard(board); } stm = MakeMove2(stm, move); // assumes MakeMove returns new side to move gameMove[moveNr++] = move; // remember game - printf("move %s%s\n", MoveToText(pMove, 1), p[undoInfo.victim].ranking == 5 && p[undoInfo.piece].ranking != 4 ? "w" : ""); + printf("move %s%s\n", MoveToText(pMove, 1), p[undoInfo.victim].ranking == 5 && p[undoInfo.piece].ranking < 4 ? "w" : ""); listEnd = 0; continue; // go check if we should ponder }