From 7cf467de869336579256b535fa605b0aa53b991c Mon Sep 17 00:00:00 2001 From: scw Date: Mon, 15 Aug 2005 09:15:20 +0000 Subject: gomoku and go logging update git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3037 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/chess.c | 3 +-- mbbsd/go.c | 4 ++-- mbbsd/gomo.c | 13 ++++++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/mbbsd/chess.c b/mbbsd/chess.c index 1b585f12..255f1ed6 100644 --- a/mbbsd/chess.c +++ b/mbbsd/chess.c @@ -704,8 +704,7 @@ ChessGenLogGlobal(ChessInfo* info, ChessGameResult result) fclose(fp); strlcpy(log_header.owner, "[棋譜機器人]", sizeof(log_header.owner)); - snprintf(log_header.title, sizeof(log_header.title), - ANSI_COLOR(37;41) "棋譜" ANSI_RESET " %s VS %s", + snprintf(log_header.title, sizeof(log_header.title), "[棋譜] %s VS %s", info->user1.userid, info->user2.userid); setbdir(buf, info->constants->log_board); diff --git a/mbbsd/go.c b/mbbsd/go.c index 3e69efe4..941c2d2e 100644 --- a/mbbsd/go.c +++ b/mbbsd/go.c @@ -386,7 +386,7 @@ GO_log(struct GOData *gd, char *userid) } while (++ptr < v); - fprintf(fp, "\n\n《以下為 sgf 格式棋譜》\n\n(;GM[1]"); + fprintf(fp, "\n\n《以下為 sgf 格式棋譜》\n\n(;GM[1]"); if (userid == NULL) fprintf(fp, "GN[Gobot-Gobot FPG]\n"); else @@ -423,7 +423,7 @@ GO_log(struct GOData *gd, char *userid) i++; } while (++ptr < v); - fprintf(fp, ";)\n\n"); + fprintf(fp, ";)\n\n\n"); fclose(fp); mymail.filemode = FILE_READ; diff --git a/mbbsd/gomo.c b/mbbsd/gomo.c index 561c4003..6c08565f 100644 --- a/mbbsd/gomo.c +++ b/mbbsd/gomo.c @@ -238,8 +238,8 @@ static char* gomo_getstep(const gomo_step_t* step, char buf[]) { const static char* const ColName = "ABCDEFGHIJKLMN"; - const static char* const RawName = "123456789101112131415"; - const static int ansi_length = sizeof(ANSI_COLOR(30;43)); + const static char* const RawName = "151413121110987654321"; + const static int ansi_length = sizeof(ANSI_COLOR(30;43)) - 1; strcpy(buf, turn_color[step->color]); buf[ansi_length ] = ColName[step->loc.c * 2]; @@ -410,7 +410,7 @@ gomo_genlog(ChessInfo* info, FILE* fp, ChessGameResult result) const int nStep = info->history.used; int i; - for (i = 1; i < 18; i++) + for (i = 1; i <= 18; i++) fprintf(fp, "%.*s\n", big_picture[i].len, big_picture[i].data); fprintf(fp, "\nblack:%s\nwhite:%s\n", @@ -420,8 +420,11 @@ gomo_genlog(ChessInfo* info, FILE* fp, ChessGameResult result) for (i = 0; i < nStep; ++i) { const gomo_step_t* const step = (const gomo_step_t*) ChessHistoryRetrieve(info, i); - fprintf(fp, "[%2d]%s ==> %c%-5d", i + 1, bw_chess[i % 2], - 'A' + step->loc.c, step->loc.r + 1); + if (step->type == CHESS_STEP_NORMAL) + fprintf(fp, "[%2d]%s ==> %c%-5d", i + 1, bw_chess[step->color], + 'A' + step->loc.c, 15 - step->loc.r); + else + break; if (i % 2) fputc('\n', fp); } -- cgit v1.2.3