#define FVAL 5000 /* piece value of Fire Demon. Used in code for recognizing moves with it and do burns */\r
\r
PieceDesc chuPieces[] = {\r
- {"LN", "", LVAL, { L,L,L,L,L,L,L,L }, 4 }, // lion\r
+ {"LN", "", LVAL, { T,T,T,T,T,T,T,T }, 4 }, // lion\r
+// {"LN", "", LVAL, { L,L,L,L,L,L,L,L }, 4 }, // lion\r
{"FK", "", 600, { X,X,X,X,X,X,X,X }, 4 }, // free king\r
{"SE", "", 550, { X,D,X,X,X,X,X,D }, 4 }, // soaring eagle\r
{"HF", "", 500, { D,X,X,X,X,X,X,X }, 4 }, // horned falcon\r
// Lion-Dog triple moves\r
toList[64+i] = 3*kStep[i]; epList[64+i] = kStep[i];\r
toList[72+i] = 3*kStep[i]; epList[72+i] = 2*kStep[i];\r
- toList[80+i] = 3*kStep[i]; epList[80+i] = kStep[i]; ep2List[80+i] = 2*kStep[i];\r
+ toList[80+i] = 3*kStep[i]; epList[80+i] = 2*kStep[i]; ep2List[80+i] = kStep[i];\r
toList[88+i] = kStep[i]; epList[88+i] = 2*kStep[i];\r
}\r
\r
if(t >= SPECIAL) {\r
if(t < CASTLE) { // castling is printed as a single move, implying its side effects\r
int e = f + epList[t - SPECIAL];\r
-// printf("take %c%d\n", e%BW+'a', e/BW+ONE);\r
- sprintf(buf, "%c%d%c%d,", f%BW+'a', f/BW+ONE, e%BW+'a', e/BW+ONE); f = e;\r
- if(multiLine) printf("move %s\n", buf), buf[0] = '\0';\r
if(ep2List[t - SPECIAL]) {\r
- e = g + ep2List[t - SPECIAL];\r
+ int e2 = f + ep2List[t - SPECIAL];\r
// printf("take %c%d\n", e%BW+'a', e/BW+ONE);\r
- sprintf(buf+strlen(buf), "%c%d%c%d,", f%BW+'a', f/BW+ONE, e%BW+'a', e/BW+ONE); f = e;\r
- if(multiLine) printf("move %s\n", buf), buf[0] = '\0';\r
+ sprintf(buf+strlen(buf), "%c%d%c%d,", f%BW+'a', f/BW+ONE, e2%BW+'a', e2/BW+ONE); f = e2;\r
+ if(multiLine) printf("move %s\n", buf), buf[0] = '\0';\r
}\r
+// printf("take %c%d\n", e%BW+'a', e/BW+ONE);\r
+ sprintf(buf, "%c%d%c%d,", f%BW+'a', f/BW+ONE, e%BW+'a', e/BW+ONE); f = e;\r
+ if(multiLine) printf("move %s\n", buf), buf[0] = '\0';\r
}\r
t = g + toList[t - SPECIAL];\r
}\r
e = t;\r
moveText += ReadSquare(moveText, &t);\r
for(i=0; i<8; i++) if(f + kStep[i] == e) break;\r
- if(i >= 8) return INVALID; // this rejects Lion Dog 2+1 and 2-1 moves!\r
- for(j=0; j<8; j++) if(e + kStep[j] == t) break;\r
- if(j >= 8) return INVALID; // this rejects Lion Dog 1+2 moves!\r
- t2 = SPECIAL + 8*i + j;\r
+ if(i >= 8) { // first leg not King step. Try Lion Dog 2+1 or 2-1\r
+ for(i=0; i<8; i++) if(f + 2*kStep[i] == e) break;\r
+ if(i >= 8) return INVALID; // not even that\r
+ if(f + 3*kStep[i] == t) t2 = SPECIAL + 72 + i; // 2+1\r
+ else if(f + kStep[i] == t) t2 = SPECIAL + 88 + i; // 2-1\r
+ else return INVALID;\r
+ } else if(f + 3*kStep[i] == t) { // Lion Dog 1+2 move\r
+ t2 = SPECIAL + 64 + i;\r
+ } else if(*moveText == ',') { // 3rd leg follows!\r
+ if(f + 2*kStep[i] != t) return INVALID; // 3-leg moves must be linear!\r
+ moveText += ReadSquare(moveText, &e);\r
+ if(e != t) return INVALID; // must again continue with same piece\r
+ moveText += ReadSquare(moveText, &t);\r
+ if(f + 3*kStep[i] == t) t2 = SPECIAL + 80 + i; // 1+1+1\r
+ else if(f + kStep[i] == t) t2 = SPECIAL + 88 + i; // 2-1 entered as 1+1-1\r
+ else return INVALID;\r
+ } else {\r
+ for(j=0; j<8; j++) if(e + kStep[j] == t) break;\r
+ if(j >= 8) return INVALID; // this rejects Lion Dog 1+2 moves!\r
+ t2 = SPECIAL + 8*i + j;\r
+ }\r
} else if(chessFlag && board[f] != EMPTY && p[board[f]].value == pVal && board[t] == EMPTY) { // Pawn to empty, could be e.p.\r
if(t == f + BW + 1) t2 = SPECIAL + 16; else\r
if(t == f + BW - 1) t2 = SPECIAL + 48; else\r
int e, t = moveStack[i] & SQUARE;\r
if(t < SPECIAL) continue; // only special moves\r
e = lastLift + epList[t - SPECIAL]; // decode\r
+ if(sqr == lastLift + ep2List[t - SPECIAL]) { // second leg of 3-leg move\r
+ b[e] = 'C'; cnt++;\r
+ continue;\r
+ }\r
t = lastLift + toList[t - SPECIAL];\r
if(e != sqr) continue;\r
- b[t] = (!boardCopy[t] ? 'Y' : 'R'); cnt++;\r
+ if(!b[t]) b[t] = (!boardCopy[t] ? 'Y' : 'R'); cnt++;\r
}\r
}\r
if(!cnt) return;\r