From 4b32cf9c95afe8272e7a1e68be72a48c99235a65 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Fri, 6 Jul 2012 09:38:26 +0200 Subject: [PATCH] Add null move The WB Alien null-move notation is recognized on input, and generated on output. The internal representation is a move towards the same square by a piece that has this capability. (This currently fails on a1, due to 0 being used as representation for invalid moves!) Only one null move is generated and added to the move list. The null move is not searched yet. --- hachu.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/hachu.c b/hachu.c index ff3c901..fd6cbfe 100644 --- a/hachu.c +++ b/hachu.c @@ -46,7 +46,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 */ @@ -1289,6 +1289,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; } @@ -1533,6 +1538,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]; @@ -1565,6 +1571,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 == ',') { @@ -1581,9 +1588,12 @@ 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 } -- 1.7.0.4