const char *wpstring[] = {" ", "P", "N", "B", "R", "A", "C", "M", "Q", "E", "B", "Q", "W", "H", "N", "D", "H", "L",
- "C", "S", "G", "H", "A", "F", "E", "H", "M", "S", "E", "W", "O", "G", "V", "S", "E", "A", "K"};
+ "C", "S", "G", "H", "A", "F", "E", "H", "M", "S", "E", "W", "O", "G", "V", "S", "E", "A", "K", "H", "E"};
const char *bpstring[] = {" ", "p", "n", "b", "r", "a", "c", "m", "q", "e", "b", "q", "w", "h", "n", "d", "h", "l",
- "c", "s", "g", "h", "a", "f", "e", "h", "m", "s", "e", "w", "o", "g", "v", "s", "e", "a", "k"};
+ "c", "s", "g", "h", "a", "f", "e", "h", "m", "s", "e", "w", "o", "g", "v", "s", "e", "a", "k", "h", "e"};
-int pieceValues[KING+1] = {0, 1, 3, 3, 5, 8, 9, 3, 9, 1, 1, 2, 2, 2, 1, 6, 5, 2, 3, 3, 3, 1, 5, 2, 1, 7, 7, 3, 3, 3, 7, 7, 7, 8, 9, 12, 0};
+int pieceValues[PIECES] = {0, 1, 3, 3, 5, 8, 9, 3, 9, 1, 1, 2, 2, 2, 1, 6, 5, 2, 3, 3, 3, 1, 5, 2, 1, 7, 7, 3, 3, 3, 7, 7, 7, 8, 9, 12, 0, 8, 9};
static const int mach_type = (1<<7) | (1<<8) | (1<<9) | (1<<10) | (1<<11);
#define IsMachineStyle(n) (((1<<(n)) & mach_type) != 0)
for (f = 0; f < 2; f++) {
for (r = 0; r < BW; r++)
gs->ep_possible[f][r] = 0;
- for (r = PAWN; r <= KING-1; r++)
+ for (r = PAWN; r <= PIECES-1; r++)
gs->holding[f][r-PAWN] = 0;
}
gs->wkmoved = gs->wqrmoved = gs->wkrmoved = -1; // [HGM] castle: no rights
{
int f,r;
- for (f = 0; f < BW; f++)\r
- for (r = 0; r < BH; r++)\r
- gs->board[f][r] = NOPIECE;\r
- for (f = 0; f < gs->files; f++)\r
- gs->board[f][gs->ranks-7] = W_PAWN;\r
- for (f = 0; f < gs->files; f++)\r
- gs->board[f][6] = B_PAWN;\r
- gs->board[0][0] = W_ROOK;\r
- gs->board[1][0] = W_KNIGHT;\r
- gs->board[2][0] = W_BISHOP; \r
- gs->board[3][0] = W_QUEEN;\r
- gs->board[gs->files/2][0] = W_KING;\r
- gs->board[gs->files-3][0] = W_BISHOP;\r
- gs->board[gs->files-2][0] = W_KNIGHT;\r
- gs->board[gs->files-1][0] = W_ROOK;\r
- gs->board[0][gs->ranks-1] = B_ROOK;\r
- gs->board[1][gs->ranks-1] = B_KNIGHT;\r
- gs->board[2][gs->ranks-1] = B_BISHOP;\r
- gs->board[3][gs->ranks-1] = B_QUEEN;\r
- gs->board[gs->files/2][gs->ranks-1] = B_KING;\r
- gs->board[gs->files-3][gs->ranks-1] = B_BISHOP;\r
- gs->board[gs->files-2][gs->ranks-1] = B_KNIGHT;\r
- gs->board[gs->files-1][gs->ranks-1] = B_ROOK;\r
+ for (f = 0; f < BW; f++)
+ for (r = 0; r < BH; r++)
+ gs->board[f][r] = NOPIECE;
+ for (f = 0; f < gs->files; f++)
+ gs->board[f][gs->ranks-7] = W_PAWN;
+ for (f = 0; f < gs->files; f++)
+ gs->board[f][6] = B_PAWN;
+ gs->board[0][0] = W_ROOK;
+ gs->board[1][0] = W_KNIGHT;
+ gs->board[2][0] = W_BISHOP;
+ gs->board[3][0] = W_QUEEN;
+ gs->board[gs->files/2][0] = W_KING;
+ gs->board[gs->files-3][0] = W_BISHOP;
+ gs->board[gs->files-2][0] = W_KNIGHT;
+ gs->board[gs->files-1][0] = W_ROOK;
+ gs->board[0][gs->ranks-1] = B_ROOK;
+ gs->board[1][gs->ranks-1] = B_KNIGHT;
+ gs->board[2][gs->ranks-1] = B_BISHOP;
+ gs->board[3][gs->ranks-1] = B_QUEEN;
+ gs->board[gs->files/2][gs->ranks-1] = B_KING;
+ gs->board[gs->files-3][gs->ranks-1] = B_BISHOP;
+ gs->board[gs->files-2][gs->ranks-1] = B_KNIGHT;
+ gs->board[gs->files-1][gs->ranks-1] = B_ROOK;
#if 1
- if(gs->files == 10) {\r
- gs->board[6][0] = W_CARDINAL;\r
- gs->board[4][0] = W_MARSHALL;\r
- gs->board[6][gs->ranks-1] = B_CARDINAL;\r
- gs->board[4][gs->ranks-1] = B_MARSHALL;\r
- }\r
- if(gs->royalKnight) {\r
- gs->board[1][0] = W_MAN;\r
- gs->board[gs->files-2][0] = W_MAN;\r
- gs->board[1][gs->ranks-1] = B_MAN;\r
- gs->board[gs->files-2][gs->ranks-1] = B_MAN;\r
- }\r
+ if(gs->files == 10) {
+ gs->board[6][0] = W_CARDINAL;
+ gs->board[4][0] = W_MARSHALL;
+ gs->board[6][gs->ranks-1] = B_CARDINAL;
+ gs->board[4][gs->ranks-1] = B_MARSHALL;
+ }
+ if(gs->royalKnight) {
+ gs->board[1][0] = W_MAN;
+ gs->board[gs->files-2][0] = W_MAN;
+ gs->board[1][gs->ranks-1] = B_MAN;
+ gs->board[gs->files-2][gs->ranks-1] = B_MAN;
+ }
#endif
reset_board_vars(gs);
int retval = 0;
int wval, i, j;
- b->files = b->ranks = 8;\r
- b->pawnDblStep = (!category || strcmp(category, "shatranj")); \r
- b->royalKnight = (category && !strcmp(category, "knightmate"));\r
+ b->files = b->ranks = 8;
+ b->pawnDblStep = (!category || strcmp(category, "shatranj"));
+ b->royalKnight = (category && !strcmp(category, "knightmate"));
b->capablancaPieces = 0;
b->holdings = 0;
b->drops = 0;
b->stalemate = 1;
b->promoType = 1;
b->promoZone = 1;
- b->variant[0] = 0; // [HGM] variant: default is normal, if variant name is missing\r
- if (!category || !board || !category[0] || !board[0]) \r
- /* accounts for bughouse too */\r
- board_standard(b);\r
+ b->variant[0] = 0; // [HGM] variant: default is normal, if variant name is missing
+ if (!category || !board || !category[0] || !board[0])
+ /* accounts for bughouse too */
+ board_standard(b);
else {
- if(category && category[0]) strcpy(b->variant, category); // [HGM] variant: remember category name\r
+ if(category && category[0]) strcpy(b->variant, category); // [HGM] variant: remember category name
if (!strcmp(category, "wild") && sscanf(board, "%d", &wval) == 1) {
- if(wval >= 1 && wval <= 4)\r
+ if(wval >= 1 && wval <= 4)
wild_update(b->board, wval);
- sprintf(b->variant, "wild/%d", wval);\r
+ sprintf(b->variant, "wild/%d", wval);
}
if (board && !strcmp(board, "0"))
- b->setup = 0; // [HGM] variant: any board in the default file "0" is supposed to be implied by the variant\r
+ b->setup = 0; // [HGM] variant: any board in the default file "0" is supposed to be implied by the variant
- if (!strcmp(category, "knightmate")) {\r
- board_standard(b);\r
- } else if (!strcmp(category, "super")) {\r
+ if (!strcmp(category, "knightmate")) {
+ board_standard(b);
+ } else if (!strcmp(category, "super")) {
board_standard(b);
b->holdings = 1;
b->promoType = 2;
placed = 1;
} while(!placed);
}
- b->setup = 1;\r
- } else if (!strcmp(category, "fischerandom")) {\r
+ b->setup = 1;
+ } else if (!strcmp(category, "fischerandom")) {
wild_update(b->board, 22);
b->castlingStyle = 2;
- b->setup = 1; // [HGM] FRC: even the default is a setup position, for which an initial board has to be printed\r
+ b->setup = 1; // [HGM] FRC: even the default is a setup position, for which an initial board has to be printed
} else if (!strcmp(category, "caparandom")) {
- b->files = 10;\r
+ b->files = 10;
wild_update(b->board, 46);
b->castlingStyle = 2;
- b->setup = 1; \r
- } else retval = board_read_file(category, board, b); \r
+ b->setup = 1;
+ } else retval = board_read_file(category, board, b);
}
if(b->setup && game_globals.garray[g].FENstartPos[0]) // [HGM] use pre-existing start position, if one available
FEN_to_board(game_globals.garray[g].FENstartPos, b); // (could be wild board, or shuffle variant)
}
}
}
-\r
+
MakeFENpos(g, game_globals.garray[g].FENstartPos);
return retval;
*p += pieceValues[piecetype(b->board[r][f])];
}
}
- for (r = PAWN; r < KING; r++) {
+ for (r = PAWN; r < PIECES; r++) {
*ws += b->holding[0][r-1] * pieceValues[r];
*bs += b->holding[1][r-1] * pieceValues[r];
}
int p,i,j;
i = 0;
- for (p = PAWN; p < KING; p++) {
+ for (p = PAWN; p < PIECES; p++) {
for (j = 0; j < holding[p-1]; j++) {
tmp[i++] = wpstring[p][0];
}
int p)
{
int bh = (b->gameNum >= 0 && game_globals.garray[b->gameNum].link >= 0
- || b->holdings ); // [HGM] zh: make sure holdings are printed
+ || b->holdings || b->drops == 2); // [HGM] zh: make sure holdings are printed (also in Seirawan)
orient = orientation;
myTurn = relation;
const char *top, const char *mid, const char *start, const char *end,
const char *label,const char *blabel)
{
- int f, r, count, i;\r
- char tmp[80], mylabel[80], *p, *q, myTop[80], myMid[80];\r
- int firstR, lastR, firstF, lastF, inc;\r
- int ws, bs, sqrSize = strlen(wp[0]);\r
-\r
- board_calc_strength(b, &ws, &bs);\r
- if (orient == WHITE) {\r
- firstR = b->ranks-1;\r
- firstF = b->files-1;\r
- lastR = lastF = 0;\r
- inc = -1;\r
- } else {\r
- firstR = firstF = 0;\r
- lastR = b->ranks-1;\r
- lastF = b->files-1;\r
- inc = 1;\r
+ int f, r, count, i;
+ char tmp[80], mylabel[80], *p, *q, myTop[80], myMid[80];
+ int firstR, lastR, firstF, lastF, inc;
+ int ws, bs, sqrSize = strlen(wp[0]);
+
+ board_calc_strength(b, &ws, &bs);
+ if (orient == WHITE) {
+ firstR = b->ranks-1;
+ firstF = b->files-1;
+ lastR = lastF = 0;
+ inc = -1;
+ } else {
+ firstR = firstF = 0;
+ lastR = b->ranks-1;
+ lastF = b->files-1;
+ inc = 1;
}
strcpy(myTop, top);
strcpy(myMid, mid);
- Enlarge(myTop, sqrSize, b->files);\r
- Enlarge(myMid, sqrSize, b->files);\r
- strcat(bstring, myTop);\r
- for (f = firstR, count = b->ranks-1; f != lastR + inc; f += inc, count--) {\r
- sprintf(tmp, " %d %s", f + (b->ranks < 10), start);\r
- strcat(bstring, tmp);\r
- for (r = lastF; r != firstF - inc; r = r - inc) {\r
- if (square_color(r, f) == WHITE)\r
- strcat(bstring, wsqr);\r
- else\r
- strcat(bstring, bsqr);\r
- if (piecetype(b->board[r][f]) == NOPIECE) {\r
- if (square_color(r, f) == WHITE)\r
- strcat(bstring, bp[0]);\r
- else\r
- strcat(bstring, wp[0]);\r
+ Enlarge(myTop, sqrSize, b->files);
+ Enlarge(myMid, sqrSize, b->files);
+ strcat(bstring, myTop);
+ for (f = firstR, count = b->ranks-1; f != lastR + inc; f += inc, count--) {
+ sprintf(tmp, " %d %s", f + (b->ranks < 10), start);
+ strcat(bstring, tmp);
+ for (r = lastF; r != firstF - inc; r = r - inc) {
+ if (square_color(r, f) == WHITE)
+ strcat(bstring, wsqr);
+ else
+ strcat(bstring, bsqr);
+ if (piecetype(b->board[r][f]) == NOPIECE) {
+ if (square_color(r, f) == WHITE)
+ strcat(bstring, bp[0]);
+ else
+ strcat(bstring, wp[0]);
} else {
int piece = piecetype(b->board[r][f]);
-// if(piece > QUEEN) piece = ELEPHANT + (piece == KING); // All fairies become elephants in ascii styles\r
- if (colorval(b->board[r][f]) == WHITE)\r
- strcat(bstring, wp[piece]);\r
- else\r
- strcat(bstring, bp[piece]);\r
- }\r
- }\r
- sprintf(tmp, "%s", end);\r
- strcat(bstring, tmp);\r
- switch (count) {\r
- case 7:\r
- sprintf(tmp, " Move # : %d (%s)", b->moveNum, CString(b->onMove));\r
- strcat(bstring, tmp);\r
- break;\r
- case 6:\r
-/* if ((b->moveNum > 1) || (b->onMove == BLACK)) { */\r
-/* The change from the above line to the one below is a kludge by hersco. */\r
- if (game_globals.garray[b->gameNum].numHalfMoves > 0) {\r
-/* loon: think this fixes the crashing ascii board on takeback bug */\r
- sprintf(tmp, " %s Moves : '%s'", CString(CToggle(b->onMove)),\r
- move_and_time(&ml[game_globals.garray[b->gameNum].numHalfMoves - 1]));\r
- strcat(bstring, tmp);\r
- }\r
- break;\r
- case 5:\r
- break;\r
- case 4:\r
- sprintf(tmp, " Black Clock : %s", tenth_str(((bTime > 0) ? bTime : 0), 1));\r
- strcat(bstring, tmp);\r
- break;\r
- case 3:\r
- sprintf(tmp, " White Clock : %s", tenth_str(((wTime > 0) ? wTime : 0), 1));\r
- strcat(bstring, tmp);\r
- break;\r
- case 2:\r
- sprintf(tmp, " Black Strength : %d", bs);\r
- strcat(bstring, tmp);\r
- break;\r
- case 1:\r
- sprintf(tmp, " White Strength : %d", ws);\r
- strcat(bstring, tmp);\r
- break;\r
- case 0:\r
- break;\r
- }\r
- strcat(bstring, "\n");\r
- if (count != 0)\r
- strcat(bstring, myMid);\r
- else\r
- strcat(bstring, myTop);\r
- }\r
+// if(piece > QUEEN) piece = ELEPHANT + (piece == KING); // All fairies become elephants in ascii styles
+ if (colorval(b->board[r][f]) == WHITE)
+ strcat(bstring, wp[piece]);
+ else
+ strcat(bstring, bp[piece]);
+ }
+ }
+ sprintf(tmp, "%s", end);
+ strcat(bstring, tmp);
+ switch (count) {
+ case 7:
+ sprintf(tmp, " Move # : %d (%s)", b->moveNum, CString(b->onMove));
+ strcat(bstring, tmp);
+ break;
+ case 6:
+/* if ((b->moveNum > 1) || (b->onMove == BLACK)) { */
+/* The change from the above line to the one below is a kludge by hersco. */
+ if (game_globals.garray[b->gameNum].numHalfMoves > 0) {
+/* loon: think this fixes the crashing ascii board on takeback bug */
+ sprintf(tmp, " %s Moves : '%s'", CString(CToggle(b->onMove)),
+ move_and_time(&ml[game_globals.garray[b->gameNum].numHalfMoves - 1]));
+ strcat(bstring, tmp);
+ }
+ break;
+ case 5:
+ break;
+ case 4:
+ sprintf(tmp, " Black Clock : %s", tenth_str(((bTime > 0) ? bTime : 0), 1));
+ strcat(bstring, tmp);
+ break;
+ case 3:
+ sprintf(tmp, " White Clock : %s", tenth_str(((wTime > 0) ? wTime : 0), 1));
+ strcat(bstring, tmp);
+ break;
+ case 2:
+ sprintf(tmp, " Black Strength : %d", bs);
+ strcat(bstring, tmp);
+ break;
+ case 1:
+ sprintf(tmp, " White Strength : %d", ws);
+ strcat(bstring, tmp);
+ break;
+ case 0:
+ break;
+ }
+ strcat(bstring, "\n");
+ if (count != 0)
+ strcat(bstring, myMid);
+ else
+ strcat(bstring, myTop);
+ }
q = mylabel; i = 0;
- if (orient == WHITE) {\r
+ if (orient == WHITE) {
p = label;
while(*p) {
switch(*p) {
*q++ = *p++ + b->files - 12;
if(++i >= b->files) { *q++ = '\n'; *q++ = 0; }
}
- }\r
- }\r
+ }
+ }
*q++ = 0;
- strcat(bstring, mylabel);\r
- return 0;\r
+ strcat(bstring, mylabel);
+ return 0;
}
-/* Experimental ANSI board for colour representation */\r
-static int style13(struct game_state_t *b, struct move_t *ml)\r
-{\r
- static const char *wp[] = {" ", "\033[37m\033[1m P ", "\033[37m\033[1m N ", "\033[37m\033[1m B ", "\033[37m\033[1m R ", "\033[37m\033[1m A ", "\033[37m\033[1m C ", "\033[37m\033[1m M ", "\033[37m\033[1m Q ", "\033[37m\033[1m E ", "\033[37m\033[1m K "};\r
- static const char *bp[] = {" ", "\033[21m\033[37m P ", "\033[21m\033[37m N ", "\033[21m\033[37m B ", "\033[21m\033[37m R ", "\033[21m\033[37m A ", "\033[21m\033[37m C ", "\033[21m\033[37m M ", "\033[21m\033[37m Q ", "\033[21m\033[37m E ", "\033[21m\033[37m K "};\r
- static const char *wsqr = "\033[40m";\r
- static const char *bsqr = "\033[45m";\r
- static const char *top = "\t+------------------------+\n";\r
- static const char *mid = "";\r
- static const char *start = "|";\r
- static const char *end = "\033[0m|";\r
- static const char *label = "\t a b c d e f g h i j k l\n";\r
- static const char *blabel = "\t l k j i h g f e d c b a\n";\r
-return 0;\r
- return genstyle(b, ml, wp, bp, wsqr, bsqr, top, mid, start, end, label, blabel);\r
-}\r
-\r
-/* Standard ICS */\r
-static int style1(struct game_state_t *b, struct move_t *ml)\r
-{\r
+/* Experimental ANSI board for colour representation */
+static int style13(struct game_state_t *b, struct move_t *ml)
+{
+ static const char *wp[] = {" ", "\033[37m\033[1m P ", "\033[37m\033[1m N ", "\033[37m\033[1m B ", "\033[37m\033[1m R ", "\033[37m\033[1m A ", "\033[37m\033[1m C ", "\033[37m\033[1m M ", "\033[37m\033[1m Q ", "\033[37m\033[1m E ", "\033[37m\033[1m K "};
+ static const char *bp[] = {" ", "\033[21m\033[37m P ", "\033[21m\033[37m N ", "\033[21m\033[37m B ", "\033[21m\033[37m R ", "\033[21m\033[37m A ", "\033[21m\033[37m C ", "\033[21m\033[37m M ", "\033[21m\033[37m Q ", "\033[21m\033[37m E ", "\033[21m\033[37m K "};
+ static const char *wsqr = "\033[40m";
+ static const char *bsqr = "\033[45m";
+ static const char *top = "\t+------------------------+\n";
+ static const char *mid = "";
+ static const char *start = "|";
+ static const char *end = "\033[0m|";
+ static const char *label = "\t a b c d e f g h i j k l\n";
+ static const char *blabel = "\t l k j i h g f e d c b a\n";
+return 0;
+ return genstyle(b, ml, wp, bp, wsqr, bsqr, top, mid, start, end, label, blabel);
+}
+
+/* Standard ICS */
+static int style1(struct game_state_t *b, struct move_t *ml)
+{
static const char *wp[] = {" |", " P |", " N |", " B |", " R |", " A |", " C |", " M |", " Q |", " E |", " B |", " Q |",
" W |", " H |", " N |", " D |", " H |", " L |", " C |", " S |", " G |", " H |", " A |", " F |",
- " E |", " H |", " M |", " S |", " E |", " W |", " O |", " G |", " V |", " S |", " E |", " A |", " K |"};
+ " E |", " H |", " M |", " S |", " E |", " W |", " O |", " G |", " V |", " S |", " E |", " A |", " K |", " H |", " E |"};
static const char *bp[] = {" |", " *P|", " *N|", " *B|", " *R|", " *A|", " *C|", " *M|", " *Q|", " *E|", " *B|", " *Q|",
" *W|", " *H|", " *N|", " *D|", " *H|", " *L|", " *C|", " *S|", " *G|", " *H|", " *A|", " *F|",
- " *E|", " *H|", " *M|", " *S|", " *E|", " *W|", " *O|", " *G|", " *V|", " *S|", " *E|", " *A|", " *K|"};
- static char *wsqr = "";\r
- static char *bsqr = "";\r
- static char *top = "\t---------------------------------\n";\r
- static char *mid = "\t|---+---+---+---+---+---+---+---|\n";\r
- static char *start = "|";\r
- static char *end = "";\r
- static char *label = "\t a b c d e f g h i j k l\n";\r
- static char *blabel = "\t l k j i h g f e d c b a\n";\r
-\r
- return genstyle(b, ml, wp, bp, wsqr, bsqr, top, mid, start, end, label, blabel);\r
-}\r
-\r
-/* USA-Today Sports Center-style board */\r
-static int style2(struct game_state_t *b, struct move_t *ml)\r
-{\r
+ " *E|", " *H|", " *M|", " *S|", " *E|", " *W|", " *O|", " *G|", " *V|", " *S|", " *E|", " *A|", " *K|", " *H|", " *E|"};
+ static char *wsqr = "";
+ static char *bsqr = "";
+ static char *top = "\t---------------------------------\n";
+ static char *mid = "\t|---+---+---+---+---+---+---+---|\n";
+ static char *start = "|";
+ static char *end = "";
+ static char *label = "\t a b c d e f g h i j k l\n";
+ static char *blabel = "\t l k j i h g f e d c b a\n";
+
+ return genstyle(b, ml, wp, bp, wsqr, bsqr, top, mid, start, end, label, blabel);
+}
+
+/* USA-Today Sports Center-style board */
+static int style2(struct game_state_t *b, struct move_t *ml)
+{
static const char *wp[] = {"- ", "P ", "N ", "B ", "R ", "A ", "C ", "M ", "Q ", "E ", "B ", "Q ",
"W ", "H ", "N ", "D ", "H ", "L ", "C ", "S ", "G ", "H ", "A ", "F ",
- "E ", "H ", "M ", "S ", "E ", "W ", "O ", "G ", "V ", "S ", "E ", "A ", "K "};
+ "E ", "H ", "M ", "S ", "E ", "W ", "O ", "G ", "V ", "S ", "E ", "A ", "K ", "H ", "E "};
static const char *bp[] = {"+ ", "p' ", "n' ", "b' ", "r' ", "a' ", "c' ", "m' ", "q' ", "e' ", "b' ", "q' ",
"w' ", "h' ", "n' ", "d' ", "h' ", "l' ", "c' ", "s' ", "g' ", "h' ", "a' ", "f' ",
- "e' ", "h' ", "m' ", "s' ", "e' ", "w' ", "o' ", "g' ", "v' ", "s' ", "e' ", "a' ", "k' "};
- static char *wsqr = "";\r
- static char *bsqr = "";\r
- static char *top = "";\r
- static char *mid = "";\r
- static char *start = "";\r
- static char *end = "";\r
- static char *label = "\ta b c d e f g h i j k l\n";\r
- static char *blabel = "\tl k j i h g f e d c b a\n";\r
-\r
- return genstyle(b, ml, wp, bp, wsqr, bsqr, top, mid, start, end, label, blabel);\r
-}\r
-\r
-/* Experimental vt-100 ANSI board for dark backgrounds */\r
-static int style3(struct game_state_t *b, struct move_t *ml)\r
-{\r
+ "e' ", "h' ", "m' ", "s' ", "e' ", "w' ", "o' ", "g' ", "v' ", "s' ", "e' ", "a' ", "k' ", "h' ", "e' "};
+ static char *wsqr = "";
+ static char *bsqr = "";
+ static char *top = "";
+ static char *mid = "";
+ static char *start = "";
+ static char *end = "";
+ static char *label = "\ta b c d e f g h i j k l\n";
+ static char *blabel = "\tl k j i h g f e d c b a\n";
+
+ return genstyle(b, ml, wp, bp, wsqr, bsqr, top, mid, start, end, label, blabel);
+}
+
+/* Experimental vt-100 ANSI board for dark backgrounds */
+static int style3(struct game_state_t *b, struct move_t *ml)
+{
static const char *wp[] = {" ", " P ", " N ", " B ", " R ", " A ", " C ", " M ", " Q ", " E ", " B ", " Q ",
" W ", " H ", " N ", " D ", " H ", " L ", " C ", " S ", " G ", " H ", " A ", " F ",
- " E ", " H ", " M ", " S ", " E ", " W ", " O ", " G ", " V ", " S ", " E ", " A ", " K "};
+ " E ", " H ", " M ", " S ", " E ", " W ", " O ", " G ", " V ", " S ", " E ", " A ", " K ", " H ", " E "};
static const char *bp[] = {" ", " *P", " *N", " *B", " *R", " *A", " *C", " *M", " *Q", " *E", " *B", " *Q",
" *W", " *H", " *N", " *D", " *H", " *L", " *C", " *S", " *G", " *H", " *A", " *F",
- " *E", " *H", " *M", " *S", " *E", " *W", " *O", " *G", " *V", " *S", " *E", " *A", " *K"};
- static char *wsqr = "\033[0m";\r
- static char *bsqr = "\033[7m";\r
- static char *top = "\t+------------------------+\n";\r
- static char *mid = "";\r
- static char *start = "|";\r
- static char *end = "\033[0m|";\r
- static char *label = "\t a b c d e f g h i j k l\n";\r
- static char *blabel = "\t l k j i h g f e d c b a\n";\r
-\r
- return genstyle(b, ml, wp, bp, wsqr, bsqr, top, mid, start, end, label, blabel);\r
-}\r
-\r
-/* Experimental vt-100 ANSI board for light backgrounds */\r
-static int style4(struct game_state_t *b, struct move_t *ml)\r
-{\r
+ " *E", " *H", " *M", " *S", " *E", " *W", " *O", " *G", " *V", " *S", " *E", " *A", " *K", " *H", " *E"};
+ static char *wsqr = "\033[0m";
+ static char *bsqr = "\033[7m";
+ static char *top = "\t+------------------------+\n";
+ static char *mid = "";
+ static char *start = "|";
+ static char *end = "\033[0m|";
+ static char *label = "\t a b c d e f g h i j k l\n";
+ static char *blabel = "\t l k j i h g f e d c b a\n";
+
+ return genstyle(b, ml, wp, bp, wsqr, bsqr, top, mid, start, end, label, blabel);
+}
+
+/* Experimental vt-100 ANSI board for light backgrounds */
+static int style4(struct game_state_t *b, struct move_t *ml)
+{
static const char *wp[] = {" ", " P ", " N ", " B ", " R ", " A ", " C ", " M ", " Q ", " E ", " B ", " Q ",
" W ", " H ", " N ", " D ", " H ", " L ", " C ", " S ", " G ", " H ", " A ", " F ",
- " E ", " H ", " M ", " S ", " E ", " W ", " O ", " G ", " V ", " S ", " E ", " A ", " K "};
+ " E ", " H ", " M ", " S ", " E ", " W ", " O ", " G ", " V ", " S ", " E ", " A ", " K ", " H ", " E "};
static const char *bp[] = {" ", " *P", " *N", " *B", " *R", " *A", " *C", " *M", " *Q", " *E", " *B", " *Q",
" *W", " *H", " *N", " *D", " *H", " *L", " *C", " *S", " *G", " *H", " *A", " *F",
- " *E", " *H", " *M", " *S", " *E", " *W", " *O", " *G", " *V", " *S", " *E", " *A", " *K"};
- static char *wsqr = "\033[7m";\r
- static char *bsqr = "\033[0m";\r
- static char *top = "\t+------------------------+\n";\r
- static char *mid = "";\r
- static char *start = "|";\r
- static char *end = "\033[0m|";\r
- static char *label = "\t a b c d e f g h i j k l\n";\r
- static char *blabel = "\t l k j i h g f e d c b a\n";\r
-\r
- return genstyle(b, ml, wp, bp, wsqr, bsqr, top, mid, start, end, label, blabel);\r
-}\r
-\r
-/* Style suggested by ajpierce@med.unc.edu */\r
-static int style5(struct game_state_t *b, struct move_t *ml)\r
-{\r
+ " *E", " *H", " *M", " *S", " *E", " *W", " *O", " *G", " *V", " *S", " *E", " *A", " *K", " *H", " *E"};
+ static char *wsqr = "\033[7m";
+ static char *bsqr = "\033[0m";
+ static char *top = "\t+------------------------+\n";
+ static char *mid = "";
+ static char *start = "|";
+ static char *end = "\033[0m|";
+ static char *label = "\t a b c d e f g h i j k l\n";
+ static char *blabel = "\t l k j i h g f e d c b a\n";
+
+ return genstyle(b, ml, wp, bp, wsqr, bsqr, top, mid, start, end, label, blabel);
+}
+
+/* Style suggested by ajpierce@med.unc.edu */
+static int style5(struct game_state_t *b, struct move_t *ml)
+{
static const char *wp[] = {" ", " o ", " :N:", " <B>", " |R|", " (A)", " [C]", " :M:", " {Q}", " !E!",
" <B>", " {Q}", " .W.", " :H:", " :N:", " <H>", " |D|", " |L|",
" |C|", " !S!", " :G:", " :H:", " {A}", " {F}", " !E!", " (H)", " [M]", " :S:",
- " !E!", " |W|", " *O*", " {G}", " :V:", " (S)", " [E]", " &A&", " =K="};
+ " !E!", " |W|", " *O*", " {G}", " :V:", " (S)", " [E]", " &A&", " =K=", " (H)", " [E]"};
static const char *bp[] = {" ", " p ", " :n:", " <b>", " |r|", " (a)", " [c]", " :m:", " {q}", " !e!",
" <b>", " {q}", " .w.", " :h:", " :n:", " <h>", " |d|", " |l|",
" |c|", " !s!", " :g:", " :h:", " {a}", " {f}", " !e!", " (h)", " [m]", " :s:",
- " !e!", " |w|", " *o*", " {g}", " :v:", " (s)", " [e]", " &a&", " =k="};
- static char *wsqr = "";\r
- static char *bsqr = "";\r
- static char *top = " . . . . . . . . .\n";\r
- static char *mid = " . . . . . . . . .\n";\r
- static char *start = "";\r
- static char *end = "";\r
- static char *label = "\t a b c d e f g h i j k l\n";\r
- static char *blabel = "\t l k j i h g f e d c b a\n";\r
-\r
- return genstyle(b, ml, wp, bp, wsqr, bsqr, top, mid, start, end, label, blabel);\r
-}\r
-\r
-/* Email Board suggested by Thomas Fought (tlf@rsch.oclc.org) */\r
-static int style6(struct game_state_t *b, struct move_t *ml)\r
-{\r
+ " !e!", " |w|", " *o*", " {g}", " :v:", " (s)", " [e]", " &a&", " =k=", " (f)", " [e]"};
+ static char *wsqr = "";
+ static char *bsqr = "";
+ static char *top = " . . . . . . . . .\n";
+ static char *mid = " . . . . . . . . .\n";
+ static char *start = "";
+ static char *end = "";
+ static char *label = "\t a b c d e f g h i j k l\n";
+ static char *blabel = "\t l k j i h g f e d c b a\n";
+
+ return genstyle(b, ml, wp, bp, wsqr, bsqr, top, mid, start, end, label, blabel);
+}
+
+/* Email Board suggested by Thomas Fought (tlf@rsch.oclc.org) */
+static int style6(struct game_state_t *b, struct move_t *ml)
+{
static const char *wp[] = {" |", " wp |", " WN |", " WB |", " WR |", " WA |", " WC |", " WM |", " WQ |",
" WE |", " WB |", " WQ |", " WW |", " WH |", " WN |", " WD |", " WH |", " WL |",
" WC |", " WS |", " WG |", " WH |", " WA |", " WF |", " WE |", " WH |", " WM |",
- " WS |", " WE |", " WW |", " WO |", " WG |", " WV |", " WS |", " WE |", " WA |", " WK |"};
+ " WS |", " WE |", " WW |", " WO |", " WG |", " WV |", " WS |", " WE |", " WA |", " WK |", " WH |", " WE |"};
static const char *bp[] = {" |", " bp |", " BN |", " BB |", " BR |", " BA |", " BC |", " BM |", " BQ |",
" BE |", " BB |", " BQ |", " BW |", " BH |", " BN |", " BD |", " BH |", " BL |",
" BC |", " BS |", " BG |", " BH |", " BA |", " BF |", " BE |", " BH |", " BM |",
- " BS |", " BE |", " BW |", " BO |", " BG |", " BV |", " BS |", " BE |", " BA |", " BK |"};
- static char *wsqr = "";\r
- static char *bsqr = "";\r
- static char *top = "\t-----------------------------------------\n";\r
- static char *mid = "\t-----------------------------------------\n";\r
- static char *start = "|";\r
- static char *end = "";\r
- static char *label = "\t A B C D E F G H I J K L\n";\r
- static char *blabel = "\t L K J I H G F E D C B A\n";\r
-\r
- return genstyle(b, ml, wp, bp, wsqr, bsqr, top, mid, start, end, label, blabel);\r
-}\r
-\r
-/* Miniature board */\r
-static int style7(struct game_state_t *b, struct move_t *ml)\r
-{\r
+ " BS |", " BE |", " BW |", " BO |", " BG |", " BV |", " BS |", " BE |", " BA |", " BK |", " BH |", " BE |"};
+ static char *wsqr = "";
+ static char *bsqr = "";
+ static char *top = "\t-----------------------------------------\n";
+
+ static char *mid = "\t-----------------------------------------\n";
+ static char *start = "|";
+ static char *end = "";
+ static char *label = "\t A B C D E F G H I J K L\n";
+ static char *blabel = "\t L K J I H G F E D C B A\n";
+
+ return genstyle(b, ml, wp, bp, wsqr, bsqr, top, mid, start, end, label, blabel);
+}
+
+/* Miniature board */
+static int style7(struct game_state_t *b, struct move_t *ml)
+{
static const char *wp[] = {" ", " P", " N", " B", " R", " A", " C", " M", " Q", " E", " B", " Q", " W", " H", " N", " D", " H", " L",
- " C", " S", " G", " H", " A", " F", " E", " H", " M", " S", " E", " W", " O", " G", " V", " S", " E", " A", " K"};
+ " C", " S", " G", " H", " A", " F", " E", " H", " M", " S", " E", " W", " O", " G", " V", " S", " E", " A", " K", " H", " E"};
static const char *bp[] = {" -", " p", " n", " b", " r", " a", " c", " m", " q", " e", " b", " q", " w", " h", " n", " d", " h", " l",
- " c", " s", " g", " h", " a", " f", " e", " h", " m", " s", " e", " w", " o", " g", " v", " s", " e", " a", " k"};
- static char *wsqr = "";\r
- static char *bsqr = "";\r
- static char *top = "\t:::::::::::::::::::::\n";\r
- static char *mid = "";\r
- static char *start = "..";\r
- static char *end = " ..";\r
- static char *label = "\t a b c d e f g h i j k l\n";\r
- static char *blabel = "\t l k j i h g f e d c b a\n";\r
-\r
- return genstyle(b, ml, wp, bp, wsqr, bsqr, top, mid, start, end, label, blabel);\r
-}\r
-
-/* ICS interface maker board-- raw data dump */\r
-static int style8(struct game_state_t *b, struct move_t *ml)\r
-{\r
- char tmp[160];\r
- int f, r;\r
- int ws, bs;\r
-\r
- board_calc_strength(b, &ws, &bs);\r
- sprintf(tmp, "#@#%03d%-16s%s%-16s%s", b->gameNum + 1,\r
- game_globals.garray[b->gameNum].white_name,\r
- (orient == WHITE) ? "*" : ":",\r
- game_globals.garray[b->gameNum].black_name,\r
- (orient == WHITE) ? ":" : "*");\r
- strcat(bstring, tmp);\r
- for (r = 0; r < b->ranks; r++) {\r
- for (f = 0; f < b->files; f++) {\r
- if (b->board[f][r] == NOPIECE) {\r
- strcat(bstring, " ");\r
- } else {\r
- if (colorval(b->board[f][r]) == WHITE)\r
- strcat(bstring, wpstring[piecetype(b->board[f][r])]);\r
- else\r
- strcat(bstring, bpstring[piecetype(b->board[f][r])]);\r
- }\r
- }\r
- }\r
- sprintf(tmp, "%03d%s%02d%02d%05d%05d%-7s(%s)@#@\n",\r
- game_globals.garray[b->gameNum].numHalfMoves / 2 + 1,\r
- (b->onMove == WHITE) ? "W" : "B",\r
- ws,\r
- bs,\r
- (wTime + 5) / 10,\r
- (bTime + 5) / 10,\r
- game_globals.garray[b->gameNum].numHalfMoves ?\r
- ml[game_globals.garray[b->gameNum].numHalfMoves - 1].algString :\r
- "none",\r
- game_globals.garray[b->gameNum].numHalfMoves ?\r
- tenth_str(ml[game_globals.garray[b->gameNum].numHalfMoves - 1].tookTime, 0) :\r
- "0:00");\r
- strcat(bstring, tmp);\r
- return 0;\r
-}\r
-\r
-/* last 2 moves only (previous non-verbose mode) */\r
-static int style9(struct game_state_t *b, struct move_t *ml)\r
-{\r
- int i, count;\r
- char tmp[160];\r
- int startmove;\r
-\r
- sprintf(tmp, "\nMove %-23s%s\n",\r
- game_globals.garray[b->gameNum].white_name,\r
- game_globals.garray[b->gameNum].black_name);\r
- strcat(bstring, tmp);\r
- sprintf(tmp, "---- -------------- --------------\n");\r
- strcat(bstring, tmp);\r
- startmove = ((game_globals.garray[b->gameNum].numHalfMoves - 3) / 2) * 2;\r
- if (startmove < 0)\r
- startmove = 0;\r
- for (i = startmove, count = 0;\r
- i < game_globals.garray[b->gameNum].numHalfMoves && count < 4;\r
- i++, count++) {\r
- if (!(i & 0x01)) {\r
- sprintf(tmp, " %2d ", i / 2 + 1);\r
- strcat(bstring, tmp);\r
- }\r
- sprintf(tmp, "%-23s", move_and_time(&ml[i]));\r
- strcat(bstring, tmp);\r
- if (i & 0x01)\r
- strcat(bstring, "\n");\r
- }\r
- if (i & 0x01)\r
- strcat(bstring, "\n");\r
- return 0;\r
-}\r
-\r
-/* Sleator's 'new and improved' raw dump format... */\r
-static int style10(struct game_state_t *b, struct move_t *ml)\r
-{\r
- int f, r;\r
- char tmp[160];\r
- int ws, bs;\r
-\r
- board_calc_strength(b, &ws, &bs);\r
- sprintf(tmp, "<10>\n");\r
- strcat(bstring, tmp);\r
- for (r = b->ranks-1; r >= 0; r--) {\r
- strcat(bstring, "|");\r
- for (f = 0; f < b->files; f++) {\r
- if (b->board[f][r] == NOPIECE) {\r
- strcat(bstring, " ");\r
- } else {\r
- if (colorval(b->board[f][r]) == WHITE)\r
- strcat(bstring, wpstring[piecetype(b->board[f][r])]);\r
- else\r
- strcat(bstring, bpstring[piecetype(b->board[f][r])]);\r
- }\r
- }\r
- strcat(bstring, "|\n");\r
- }\r
- strcat(bstring, (b->onMove == WHITE) ? "W " : "B ");\r
- if (game_globals.garray[b->gameNum].numHalfMoves) {\r
- sprintf(tmp, "%d ",\r
- ml[game_globals.garray[b->gameNum].numHalfMoves - 1].doublePawn);\r
- } else {\r
- sprintf(tmp, "-1 ");\r
- }\r
- strcat(bstring, tmp);\r
- sprintf(tmp, "%d %d %d %d %d\n",\r
- (b->wkmoved >= 0 && b->wkrmoved >= 0), // [HGM] castle: inverted the logic, both must have rights\r
- (b->wkmoved >= 0 && b->wqrmoved >= 0),\r
- (b->bkmoved >= 0 && b->bkrmoved >= 0),\r
- (b->bkmoved >= 0 && b->bqrmoved >= 0),\r
- (game_globals.garray[b->gameNum].numHalfMoves - ((b->lastIrreversable == -1) ? 0 :\r
- b->lastIrreversable)));\r
- strcat(bstring, tmp);\r
- sprintf(tmp, "%d %s %s %d %d %d %d %d %d %d %d %s (%s) %s %d\n",\r
- b->gameNum,\r
- game_globals.garray[b->gameNum].white_name,\r
- game_globals.garray[b->gameNum].black_name,\r
- myTurn,\r
- game_globals.garray[b->gameNum].wInitTime / 600,\r
- game_globals.garray[b->gameNum].wIncrement / 10,\r
- ws,\r
- bs,\r
- (wTime + 5) / 10,\r
- (bTime + 5) / 10,\r
- game_globals.garray[b->gameNum].numHalfMoves / 2 + 1,\r
- game_globals.garray[b->gameNum].numHalfMoves ?\r
- ml[game_globals.garray[b->gameNum].numHalfMoves - 1].moveString :\r
- "none",\r
- game_globals.garray[b->gameNum].numHalfMoves ?\r
- tenth_str(ml[game_globals.garray[b->gameNum].numHalfMoves - 1].tookTime, 0) :\r
- "0:00",\r
- game_globals.garray[b->gameNum].numHalfMoves ?\r
- ml[game_globals.garray[b->gameNum].numHalfMoves - 1].algString :\r
- "none",\r
- (orient == WHITE) ? 0 : 1);\r
- strcat(bstring, tmp);\r
- sprintf(tmp, ">10<\n");\r
- strcat(bstring, tmp);\r
- return 0;\r
-}\r
-\r
-/* Same as 8, but with verbose moves ("P/e3-e4", instead of "e4") */\r
-static int style11(struct game_state_t *b, struct move_t *ml)\r
-{\r
- char tmp[160];\r
- int f, r;\r
- int ws, bs;\r
-\r
- board_calc_strength(b, &ws, &bs);\r
- sprintf(tmp, "#@#%03d%-16s%s%-16s%s", b->gameNum,\r
- game_globals.garray[b->gameNum].white_name,\r
- (orient == WHITE) ? "*" : ":",\r
- game_globals.garray[b->gameNum].black_name,\r
- (orient == WHITE) ? ":" : "*");\r
- strcat(bstring, tmp);\r
- for (r = 0; r < b->ranks; r++) {\r
- for (f = 0; f < b->files; f++) {\r
- if (b->board[f][r] == NOPIECE) {\r
- strcat(bstring, " ");\r
- } else {\r
- if (colorval(b->board[f][r]) == WHITE)\r
- strcat(bstring, wpstring[piecetype(b->board[f][r])]);\r
- else\r
- strcat(bstring, bpstring[piecetype(b->board[f][r])]);\r
- }\r
- }\r
- }\r
- sprintf(tmp, "%03d%s%02d%02d%05d%05d%-7s(%s)@#@\n",\r
- game_globals.garray[b->gameNum].numHalfMoves / 2 + 1,\r
- (b->onMove == WHITE) ? "W" : "B",\r
- ws,\r
- bs,\r
- (wTime + 5) / 10,\r
- (bTime + 5) / 10,\r
- game_globals.garray[b->gameNum].numHalfMoves ?\r
- ml[game_globals.garray[b->gameNum].numHalfMoves - 1].moveString :\r
- "none",\r
- game_globals.garray[b->gameNum].numHalfMoves ?\r
- tenth_str(ml[game_globals.garray[b->gameNum].numHalfMoves - 1].tookTime, 0) :\r
- "0:00");\r
- strcat(bstring, tmp);\r
- return 0;\r
-}\r
-
-
-int kludgeFlag = 0; \r
-/* Similar to style 10. See the "style12" help file for information */\r
-static int style12(struct game_state_t *b, struct move_t *ml)\r
-{\r
- int f, r;\r
- char tmp[160]; // [HGM] 80 caused problems with long login names\r
+ " c", " s", " g", " h", " a", " f", " e", " h", " m", " s", " e", " w", " o", " g", " v", " s", " e", " a", " k", " h", " e"};
+ static char *wsqr = "";
+ static char *bsqr = "";
+ static char *top = "\t:::::::::::::::::::::\n";
+ static char *mid = "";
+ static char *start = "..";
+ static char *end = " ..";
+ static char *label = "\t a b c d e f g h i j k l\n";
+ static char *blabel = "\t l k j i h g f e d c b a\n";
+
+ return genstyle(b, ml, wp, bp, wsqr, bsqr, top, mid, start, end, label, blabel);
+}
+
+/* ICS interface maker board-- raw data dump */
+static int style8(struct game_state_t *b, struct move_t *ml)
+{
+ char tmp[160];
+ int f, r;
+ int ws, bs;
+
+ board_calc_strength(b, &ws, &bs);
+ sprintf(tmp, "#@#%03d%-16s%s%-16s%s", b->gameNum + 1,
+ game_globals.garray[b->gameNum].white_name,
+ (orient == WHITE) ? "*" : ":",
+ game_globals.garray[b->gameNum].black_name,
+ (orient == WHITE) ? ":" : "*");
+ strcat(bstring, tmp);
+ for (r = 0; r < b->ranks; r++) {
+ for (f = 0; f < b->files; f++) {
+ if (b->board[f][r] == NOPIECE) {
+ strcat(bstring, " ");
+ } else {
+ if (colorval(b->board[f][r]) == WHITE)
+ strcat(bstring, wpstring[piecetype(b->board[f][r])]);
+ else
+ strcat(bstring, bpstring[piecetype(b->board[f][r])]);
+ }
+ }
+ }
+ sprintf(tmp, "%03d%s%02d%02d%05d%05d%-7s(%s)@#@\n",
+ game_globals.garray[b->gameNum].numHalfMoves / 2 + 1,
+ (b->onMove == WHITE) ? "W" : "B",
+ ws,
+ bs,
+ (wTime + 5) / 10,
+ (bTime + 5) / 10,
+ game_globals.garray[b->gameNum].numHalfMoves ?
+ ml[game_globals.garray[b->gameNum].numHalfMoves - 1].algString :
+ "none",
+ game_globals.garray[b->gameNum].numHalfMoves ?
+ tenth_str(ml[game_globals.garray[b->gameNum].numHalfMoves - 1].tookTime, 0) :
+ "0:00");
+ strcat(bstring, tmp);
+ return 0;
+}
+
+/* last 2 moves only (previous non-verbose mode) */
+static int style9(struct game_state_t *b, struct move_t *ml)
+{
+ int i, count;
+ char tmp[160];
+ int startmove;
+
+ sprintf(tmp, "\nMove %-23s%s\n",
+ game_globals.garray[b->gameNum].white_name,
+ game_globals.garray[b->gameNum].black_name);
+ strcat(bstring, tmp);
+ sprintf(tmp, "---- -------------- --------------\n");
+ strcat(bstring, tmp);
+ startmove = ((game_globals.garray[b->gameNum].numHalfMoves - 3) / 2) * 2;
+ if (startmove < 0)
+ startmove = 0;
+ for (i = startmove, count = 0;
+ i < game_globals.garray[b->gameNum].numHalfMoves && count < 4;
+ i++, count++) {
+ if (!(i & 0x01)) {
+ sprintf(tmp, " %2d ", i / 2 + 1);
+ strcat(bstring, tmp);
+ }
+ sprintf(tmp, "%-23s", move_and_time(&ml[i]));
+ strcat(bstring, tmp);
+ if (i & 0x01)
+ strcat(bstring, "\n");
+ }
+ if (i & 0x01)
+ strcat(bstring, "\n");
+ return 0;
+}
+
+/* Sleator's 'new and improved' raw dump format... */
+static int style10(struct game_state_t *b, struct move_t *ml)
+{
+ int f, r;
+ char tmp[160];
+ int ws, bs;
+
+ board_calc_strength(b, &ws, &bs);
+ sprintf(tmp, "<10>\n");
+ strcat(bstring, tmp);
+ for (r = b->ranks-1; r >= 0; r--) {
+ strcat(bstring, "|");
+ for (f = 0; f < b->files; f++) {
+ if (b->board[f][r] == NOPIECE) {
+ strcat(bstring, " ");
+ } else {
+ if (colorval(b->board[f][r]) == WHITE)
+ strcat(bstring, wpstring[piecetype(b->board[f][r])]);
+ else
+ strcat(bstring, bpstring[piecetype(b->board[f][r])]);
+ }
+ }
+ strcat(bstring, "|\n");
+ }
+ strcat(bstring, (b->onMove == WHITE) ? "W " : "B ");
+ if (game_globals.garray[b->gameNum].numHalfMoves) {
+ sprintf(tmp, "%d ",
+ ml[game_globals.garray[b->gameNum].numHalfMoves - 1].doublePawn);
+ } else {
+ sprintf(tmp, "-1 ");
+ }
+ strcat(bstring, tmp);
+ sprintf(tmp, "%d %d %d %d %d\n",
+ (b->wkmoved >= 0 && b->wkrmoved >= 0), // [HGM] castle: inverted the logic, both must have rights
+ (b->wkmoved >= 0 && b->wqrmoved >= 0),
+ (b->bkmoved >= 0 && b->bkrmoved >= 0),
+ (b->bkmoved >= 0 && b->bqrmoved >= 0),
+ (game_globals.garray[b->gameNum].numHalfMoves - ((b->lastIrreversable == -1) ? 0 :
+ b->lastIrreversable)));
+ strcat(bstring, tmp);
+ sprintf(tmp, "%d %s %s %d %d %d %d %d %d %d %d %s (%s) %s %d\n",
+ b->gameNum,
+ game_globals.garray[b->gameNum].white_name,
+ game_globals.garray[b->gameNum].black_name,
+ myTurn,
+ game_globals.garray[b->gameNum].wInitTime / 600,
+ game_globals.garray[b->gameNum].wIncrement / 10,
+ ws,
+ bs,
+ (wTime + 5) / 10,
+ (bTime + 5) / 10,
+ game_globals.garray[b->gameNum].numHalfMoves / 2 + 1,
+ game_globals.garray[b->gameNum].numHalfMoves ?
+ ml[game_globals.garray[b->gameNum].numHalfMoves - 1].moveString :
+ "none",
+ game_globals.garray[b->gameNum].numHalfMoves ?
+ tenth_str(ml[game_globals.garray[b->gameNum].numHalfMoves - 1].tookTime, 0) :
+ "0:00",
+ game_globals.garray[b->gameNum].numHalfMoves ?
+ ml[game_globals.garray[b->gameNum].numHalfMoves - 1].algString :
+ "none",
+ (orient == WHITE) ? 0 : 1);
+ strcat(bstring, tmp);
+ sprintf(tmp, ">10<\n");
+ strcat(bstring, tmp);
+ return 0;
+}
+
+/* Same as 8, but with verbose moves ("P/e3-e4", instead of "e4") */
+static int style11(struct game_state_t *b, struct move_t *ml)
+{
+ char tmp[160];
+ int f, r;
+ int ws, bs;
+
+ board_calc_strength(b, &ws, &bs);
+ sprintf(tmp, "#@#%03d%-16s%s%-16s%s", b->gameNum,
+ game_globals.garray[b->gameNum].white_name,
+ (orient == WHITE) ? "*" : ":",
+ game_globals.garray[b->gameNum].black_name,
+ (orient == WHITE) ? ":" : "*");
+ strcat(bstring, tmp);
+ for (r = 0; r < b->ranks; r++) {
+ for (f = 0; f < b->files; f++) {
+ if (b->board[f][r] == NOPIECE) {
+ strcat(bstring, " ");
+ } else {
+ if (colorval(b->board[f][r]) == WHITE)
+ strcat(bstring, wpstring[piecetype(b->board[f][r])]);
+ else
+ strcat(bstring, bpstring[piecetype(b->board[f][r])]);
+ }
+ }
+ }
+ sprintf(tmp, "%03d%s%02d%02d%05d%05d%-7s(%s)@#@\n",
+ game_globals.garray[b->gameNum].numHalfMoves / 2 + 1,
+ (b->onMove == WHITE) ? "W" : "B",
+ ws,
+ bs,
+ (wTime + 5) / 10,
+ (bTime + 5) / 10,
+ game_globals.garray[b->gameNum].numHalfMoves ?
+ ml[game_globals.garray[b->gameNum].numHalfMoves - 1].moveString :
+ "none",
+ game_globals.garray[b->gameNum].numHalfMoves ?
+ tenth_str(ml[game_globals.garray[b->gameNum].numHalfMoves - 1].tookTime, 0) :
+ "0:00");
+ strcat(bstring, tmp);
+ return 0;
+}
+
+
+int kludgeFlag = 0;
+/* Similar to style 10. See the "style12" help file for information */
+static int style12(struct game_state_t *b, struct move_t *ml)
+{
+ int f, r;
+ char tmp[160]; // [HGM] 80 caused problems with long login names
int ws, bs;
int nhm = kludgeFlag ? 0 : game_globals.garray[b->gameNum].numHalfMoves;
// [HGM] setup: the number of half moves appeared in this routine an enormous number of times,
// and had to be dug out of the game_globals, so that this routine could only be used to print
// a board from a game, and not just any board given by an isolated game_state_t. This was very
// inconvenient for printing initial boards in move lists of shuffle variants, so I added the
- // global kludgeFlag to signal that we want to print an initial position, and force nhm = 0.\r
-\r
- board_calc_strength(b, &ws, &bs);\r
-\r
- sprintf(bstring, "<12> ");\r
- for (r = b->ranks-1; r >= 0; r--) {\r
+ // global kludgeFlag to signal that we want to print an initial position, and force nhm = 0.
+
+ board_calc_strength(b, &ws, &bs);
+
+ sprintf(bstring, "<12> ");
+ for (r = b->ranks-1; r >= 0; r--) {
for (f = 0; f < b->files; f++) {
- if (b->board[f][r] == NOPIECE) {\r
- strcat(bstring, "-");\r
- } else {\r
- if (colorval(b->board[f][r]) == WHITE)\r
- strcat(bstring, wpstring[piecetype(b->board[f][r])]);\r
- else\r
- strcat(bstring, bpstring[piecetype(b->board[f][r])]);\r
- }\r
- }\r
- strcat(bstring, " ");\r
+ if (b->board[f][r] == NOPIECE) {
+ strcat(bstring, "-");
+ } else {
+ if (colorval(b->board[f][r]) == WHITE)
+ strcat(bstring, wpstring[piecetype(b->board[f][r])]);
+ else
+ strcat(bstring, bpstring[piecetype(b->board[f][r])]);
+ }
+ }
+ strcat(bstring, " ");
+ }
+
+ strcat(bstring, (b->onMove == WHITE) ? "W " : "B ");
+ if (nhm) {
+ sprintf(tmp, "%d ",
+ ml[nhm - 1].doublePawn);
+ } else {
+ sprintf(tmp, "-1 ");
}
-\r
- strcat(bstring, (b->onMove == WHITE) ? "W " : "B ");\r
- if (nhm) {\r
- sprintf(tmp, "%d ",\r
- ml[nhm - 1].doublePawn);\r
- } else {\r
- sprintf(tmp, "-1 ");\r
- }\r
- strcat(bstring, tmp);\r
- sprintf(tmp, "%d %d %d %d %d ",\r
- (b->wkmoved >= 0 && b->wkrmoved >= 0), // [HGM] castle: inverted the logic, both must have rights\r
- (b->wkmoved >= 0 && b->wqrmoved >= 0),\r
- (b->bkmoved >= 0 && b->bkrmoved >= 0),\r
- (b->bkmoved >= 0 && b->bqrmoved >= 0),\r
- (nhm - ((b->lastIrreversable == -1) ? 0 : b->lastIrreversable)));\r
strcat(bstring, tmp);
- sprintf(tmp, "%d %s %s %d %d %d %d %d %d %d %d %s (%s) %s %d %d\n",\r
- b->gameNum + 1,\r
- game_globals.garray[b->gameNum].white_name,\r
- game_globals.garray[b->gameNum].black_name,\r
- myTurn,\r
- game_globals.garray[b->gameNum].wInitTime / 600,\r
- game_globals.garray[b->gameNum].wIncrement / 10,\r
- ws,\r
- bs,\r
- (wTime / 10),\r
- (bTime / 10),\r
- nhm / 2 + 1,\r
- nhm ?\r
- ml[nhm - 1].moveString :\r
- "none",\r
- nhm ?\r
- tenth_str(ml[nhm - 1].tookTime, 0) :\r
- "0:00",\r
- nhm ?\r
- ml[nhm - 1].algString :\r
- "none", (orient == WHITE) ? 0 : 1,\r
- b->moveNum > 1 ? 1 : 0); /* ticking */\r
-
- strcat(bstring, tmp);\r
- return 0;\r
-}\r
+ sprintf(tmp, "%d %d %d %d %d ",
+ (b->wkmoved >= 0 && b->wkrmoved >= 0), // [HGM] castle: inverted the logic, both must have rights
+ (b->wkmoved >= 0 && b->wqrmoved >= 0),
+ (b->bkmoved >= 0 && b->bkrmoved >= 0),
+ (b->bkmoved >= 0 && b->bqrmoved >= 0),
+ (nhm - ((b->lastIrreversable == -1) ? 0 : b->lastIrreversable)));
+ strcat(bstring, tmp);
+ sprintf(tmp, "%d %s %s %d %d %d %d %d %d %d %d %s (%s) %s %d %d\n",
+ b->gameNum + 1,
+ game_globals.garray[b->gameNum].white_name,
+ game_globals.garray[b->gameNum].black_name,
+ myTurn,
+ game_globals.garray[b->gameNum].wInitTime / 600,
+ game_globals.garray[b->gameNum].wIncrement / 10,
+ ws,
+ bs,
+ (wTime / 10),
+ (bTime / 10),
+ nhm / 2 + 1,
+ nhm ?
+ ml[nhm - 1].moveString :
+ "none",
+ nhm ?
+ tenth_str(ml[nhm - 1].tookTime, 0) :
+ "0:00",
+ nhm ?
+ ml[nhm - 1].algString :
+ "none", (orient == WHITE) ? 0 : 1,
+ b->moveNum > 1 ? 1 : 0); /* ticking */
+
+ strcat(bstring, tmp);
+ return 0;
+}
static int board_read_file(char *category, char *gname, struct game_state_t *gs)
{
case 'd':
gs->drops = 1;
break;
+ case 'g':
+ gs->drops = 2;
+ break;
case 'h':
gs->holdings = -1; // color-flip holdings
break;
case 'B':
onPiece = BISHOP;
break;
- case 'A':\r
- onPiece = CARDINAL;\r
- break;\r
- case 'C':\r
- onPiece = MARSHALL;\r
- break;\r
- case 'M':\r
- onPiece = MAN;\r
- break;\r
+ case 'A':
+ onPiece = CARDINAL;
+ break;
+ case 'C':
+ onPiece = MARSHALL;
+ break;
+ case 'M':
+ onPiece = MAN;
+ break;
case 'Q':
onPiece = QUEEN;
break;
case 'K':
onPiece = KING;
break;
- case 'a':\r
- case 'b':\r
- case 'c':\r
- case 'd':\r
- case 'e':\r
- case 'f':\r
- case 'g':\r
- case 'h':\r
- case 'i':\r
- case 'j':\r
- case 'k':\r
- case 'l':\r
- onFile = c - 'a';\r
- if(onFile >= gs->files) { onFile = -1; break; }\r
- onRank = -1;\r
- break;\r
+ case 'D':
+ onPiece = SELEPHANT;
+ break;
+ case 'U':
+ onPiece = HAWK;
+ break;
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ onFile = c - 'a';
+ if(onFile >= gs->files) { onFile = -1; break; }
+ onRank = -1;
+ break;
case '@':
- if (onColor >= 0 && onPiece >= 0) // allow placement in holdings\r
+ if (onColor >= 0 && onPiece >= 0) // allow placement in holdings
gs->holding[onColor == BLACK][onPiece-1]++;
- break;\r
- case '1':\r
- case '2':\r
- case '3':\r
- case '4':\r
- case '5':\r
- case '6':\r
- case '7':\r
- case '8':\r
- case '9':\r
- case '0':\r
- onRank = c - '1' + (gs->ranks > 9);\r
- if(onRank < 0 || onRank >= gs->ranks) { onRank = -1; break; }\r
- if (onFile >= 0 && onColor >= 0 && onPiece >= 0)\r
- gs->board[onFile][onRank] = onPiece | onColor;\r
- break;\r case '#':
+ break;
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case '0':
+ onRank = c - '1' + (gs->ranks > 9);
+ if(onRank < 0 || onRank >= gs->ranks) { onRank = -1; break; }
+ if (onFile >= 0 && onColor >= 0 && onPiece >= 0)
+ gs->board[onFile][onRank] = onPiece | onColor;
+ break;
+ case '#':
while (!feof(fp) && c != '\n')
c = fgetc(fp); /* Comment line */
case '\n':