summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-09-09 14:10:51 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-09-09 14:10:51 +0800
commit159c1882508313f9a740b29a82dbbf0a3df9dc5d (patch)
tree0b90057e3854893159de594aca6e058b15d7acea
parent32db8b811e2bde4df23155db4fe84ab5c8afeb0f (diff)
downloadpttbbs-159c1882508313f9a740b29a82dbbf0a3df9dc5d.tar
pttbbs-159c1882508313f9a740b29a82dbbf0a3df9dc5d.tar.gz
pttbbs-159c1882508313f9a740b29a82dbbf0a3df9dc5d.tar.bz2
pttbbs-159c1882508313f9a740b29a82dbbf0a3df9dc5d.tar.lz
pttbbs-159c1882508313f9a740b29a82dbbf0a3df9dc5d.tar.xz
pttbbs-159c1882508313f9a740b29a82dbbf0a3df9dc5d.tar.zst
pttbbs-159c1882508313f9a740b29a82dbbf0a3df9dc5d.zip
merge from my branch
merge chc_*.c to chc.c merge gomo1.c into gomo.c add new feature to chc git-svn-id: http://opensvn.csie.org/pttbbs/trunk@1171 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/include/bbs.h1
-rw-r--r--pttbbs/include/modes.h5
-rw-r--r--pttbbs/include/proto.h8
-rw-r--r--pttbbs/include/pttstruct.h9
-rw-r--r--pttbbs/mbbsd/Makefile6
-rw-r--r--pttbbs/mbbsd/chc_draw.c183
-rw-r--r--pttbbs/mbbsd/chc_net.c25
-rw-r--r--pttbbs/mbbsd/chc_play.c312
-rw-r--r--pttbbs/mbbsd/chc_rule.c195
-rw-r--r--pttbbs/mbbsd/gomo.c135
-rw-r--r--pttbbs/mbbsd/gomo1.c138
-rw-r--r--pttbbs/mbbsd/mbbsd.c2
-rw-r--r--pttbbs/mbbsd/name.c2
-rw-r--r--pttbbs/mbbsd/othello.c2
-rw-r--r--pttbbs/mbbsd/talk.c14
-rw-r--r--pttbbs/sample/etc/chess/1.poem10
-rw-r--r--pttbbs/sample/etc/chess/10.poem10
-rw-r--r--pttbbs/sample/etc/chess/11.poem6
-rw-r--r--pttbbs/sample/etc/chess/12.poem6
-rw-r--r--pttbbs/sample/etc/chess/13.poem6
-rw-r--r--pttbbs/sample/etc/chess/14.poem10
-rw-r--r--pttbbs/sample/etc/chess/15.poem2
-rw-r--r--pttbbs/sample/etc/chess/16.poem2
-rw-r--r--pttbbs/sample/etc/chess/2.poem10
-rw-r--r--pttbbs/sample/etc/chess/3.poem6
-rw-r--r--pttbbs/sample/etc/chess/4.poem10
-rw-r--r--pttbbs/sample/etc/chess/5.poem8
-rw-r--r--pttbbs/sample/etc/chess/6.poem6
-rw-r--r--pttbbs/sample/etc/chess/7.poem10
-rw-r--r--pttbbs/sample/etc/chess/8.poem10
-rw-r--r--pttbbs/sample/etc/chess/9.poem6
31 files changed, 272 insertions, 883 deletions
diff --git a/pttbbs/include/bbs.h b/pttbbs/include/bbs.h
index 71a3332f..666d30c7 100644
--- a/pttbbs/include/bbs.h
+++ b/pttbbs/include/bbs.h
@@ -60,6 +60,7 @@
#include "common.h"
#include "perm.h"
#include "modes.h"
+#include "chc.h"
#include "proto.h"
#include "gomo.h"
diff --git a/pttbbs/include/modes.h b/pttbbs/include/modes.h
index a70e7047..8321fc8b 100644
--- a/pttbbs/include/modes.h
+++ b/pttbbs/include/modes.h
@@ -97,11 +97,6 @@
#define REEDIT 79
#define BLOGGING 80
-/* 象棋 */
-#define CHC_VERSUS 0 /* 雙人 */
-#define CHC_WATCH 1 /* 觀棋 */
-#define CHC_PERSONAL 2 /* 打譜 */
-
/* menu.c 中的模式 */
#define QUIT 0x666 /* Return value to abort recursive functions */
#define XEASY 0x333 /* Return value to un-redraw screen */
diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h
index 5c287dd1..d1e51a48 100644
--- a/pttbbs/include/proto.h
+++ b/pttbbs/include/proto.h
@@ -218,10 +218,6 @@ int ticket(int bid);
/* gomo */
int gomoku(int fd);
-/* gomo1 */
-int getstyle(int x, int y, int color, int limit);
-int chkwin(int style, int limit);
-
/* guess */
int guess_main();
@@ -292,6 +288,9 @@ void add_distinct(char *fname, char *line);
void show_last_call_in(int save);
int dosearchuser(char *userid);
void u_exit(char *mode);
+void talk_request(int sig);
+int reply_connection_request(userinfo_t *uip);
+void my_talk(userinfo_t * uin, int fri_stat, char defact);
/* menu */
void showtitle(char *title, char *mid);
@@ -492,6 +491,7 @@ int login_friend_online();
int isvisible_uid(int tuid);
int friend_stat(userinfo_t *me, userinfo_t * ui);
int call_in(userinfo_t *uentp, int fri_stat);
+int make_connection_to_somebody(userinfo_t *uin, int timeout);
/* tmpjack */
int reg_barbq();
diff --git a/pttbbs/include/pttstruct.h b/pttbbs/include/pttstruct.h
index 1cb59f85..991b2154 100644
--- a/pttbbs/include/pttstruct.h
+++ b/pttbbs/include/pttstruct.h
@@ -424,13 +424,4 @@ typedef struct
time_t chrono;
int recno;
} TagItem;
-
-/* 象棋 */
-typedef struct chcusr_t{
- char userid[IDLEN + 1];
- int uid;
- int win;
- int lose;
- int tie;
-} chcusr_t;
#endif
diff --git a/pttbbs/mbbsd/Makefile b/pttbbs/mbbsd/Makefile
index 5762a2d7..e6a9adbd 100644
--- a/pttbbs/mbbsd/Makefile
+++ b/pttbbs/mbbsd/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.29 2003/07/20 00:55:34 in2 Exp $
+# $Id$
.include "../pttbbs.mk"
@@ -9,8 +9,8 @@ LDFLAGS+= -L/usr/local/lib/mysql -lmysqlclient
PROG= mbbsd
OBJS= admin.o announce.o args.o bbs.o board.o cache.o cal.o card.o\
- chat.o chc_draw.o chc_net.o chc_play.o chc_rule.o chicken.o dark.o\
- edit.o friend.o gamble.o gomo.o gomo1.o guess.o indict.o io.o\
+ chat.o chc.o chicken.o dark.o\
+ edit.o friend.o gamble.o gomo.o guess.o indict.o io.o\
kaede.o lovepaper.o mail.o mbbsd.o menu.o more.o name.o osdep.o\
othello.o page.o read.o record.o register.o screen.o stuff.o\
talk.o term.o topsong.o user.o vice.o vote.o xyz.o\
diff --git a/pttbbs/mbbsd/chc_draw.c b/pttbbs/mbbsd/chc_draw.c
deleted file mode 100644
index 2cca2f19..00000000
--- a/pttbbs/mbbsd/chc_draw.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/* $Id$ */
-#include "bbs.h"
-
-#define SIDE_ROW 10
-#define TURN_ROW 11
-#define STEP_ROW 12
-#define TIME_ROW 13
-#define WARN_ROW 15
-#define MYWIN_ROW 17
-#define HISWIN_ROW 18
-
-static char *turn_str[2] = {"黑的", "紅的"};
-
-static char *num_str[10] = {
- "", "一", "二", "三", "四", "五", "六", "七", "八", "九"
-};
-
-static char *chess_str[2][8] = {
- /* 0 1 2 3 4 5 6 7 */
- {" ", "將", "士", "象", "車", "馬", "包", "卒"},
- {" ", "帥", "仕", "相", "車", "傌", "炮", "兵"}
-};
-
-static char *chess_brd[BRD_ROW * 2 - 1] = {
- /* 0 1 2 3 4 5 6 7 8 */
- "┌─┬─┬─┬─┬─┬─┬─┬─┐", /* 0 */
- "│ │ │ │\│/│ │ │ │",
- "├─┼─┼─┼─┼─┼─┼─┼─┤", /* 1 */
- "│ │ │ │/│\│ │ │ │",
- "├─┼─┼─┼─┼─┼─┼─┼─┤", /* 2 */
- "│ │ │ │ │ │ │ │ │",
- "├─┼─┼─┼─┼─┼─┼─┼─┤", /* 3 */
- "│ │ │ │ │ │ │ │ │",
- "├─┴─┴─┴─┴─┴─┴─┴─┤", /* 4 */
- "│ 楚 河 漢 界 │",
- "├─┬─┬─┬─┬─┬─┬─┬─┤", /* 5 */
- "│ │ │ │ │ │ │ │ │",
- "├─┼─┼─┼─┼─┼─┼─┼─┤", /* 6 */
- "│ │ │ │ │ │ │ │ │",
- "├─┼─┼─┼─┼─┼─┼─┼─┤", /* 7 */
- "│ │ │ │\│/│ │ │ │",
- "├─┼─┼─┼─┼─┼─┼─┼─┤", /* 8 */
- "│ │ │ │/│\│ │ │ │",
- "└─┴─┴─┴─┴─┴─┴─┴─┘" /* 9 */
-};
-
-static char *hint_str[] = {
- " q 認輸離開",
- " p 要求和棋",
- "方向鍵 移動遊標",
- "Enter 選擇/移動"
-};
-
-void
-chc_movecur(int r, int c)
-{
- move(r * 2 + 3, c * 4 + 4);
-}
-
-#define BLACK_COLOR "\033[1;36m"
-#define RED_COLOR "\033[1;31m"
-#define BLACK_REVERSE "\033[1;37;46m"
-#define RED_REVERSE "\033[1;37;41m"
-#define TURN_COLOR "\033[1;33m"
-
-static void
-showstep(board_t board)
-{
- int turn, fc, tc, eatten;
- char *dir;
-
- turn = CHE_O(board[chc_from.r][chc_from.c]);
- fc = (turn == (chc_my ^ 1) ? chc_from.c + 1 : 9 - chc_from.c);
- tc = (turn == (chc_my ^ 1) ? chc_to.c + 1 : 9 - chc_to.c);
- if (chc_from.r == chc_to.r)
- dir = "平";
- else {
- if (chc_from.c == chc_to.c)
- tc = chc_from.r - chc_to.r;
- if (tc < 0)
- tc = -tc;
-
- if ((turn == (chc_my ^ 1) && chc_to.r > chc_from.r) ||
- (turn == chc_my && chc_to.r < chc_from.r))
- dir = "進";
- else
- dir = "退";
- }
- prints("%s%s%s%s%s",
- turn == 0 ? BLACK_COLOR : RED_COLOR,
- chess_str[turn][CHE_P(board[chc_from.r][chc_from.c])],
- num_str[fc], dir, num_str[tc]);
- eatten = board[chc_to.r][chc_to.c];
- if (eatten)
- prints(": %s%s",
- CHE_O(eatten) == 0 ? BLACK_COLOR : RED_COLOR,
- chess_str[CHE_O(eatten)][CHE_P(eatten)]);
- prints("\033[m");
-}
-
-void
-chc_drawline(board_t board, chcusr_t *user1, chcusr_t *user2, int line)
-{
- int i, j;
-
- move(line, 0);
- clrtoeol();
- if (line == 0) {
- prints("\033[1;46m 象棋對戰 \033[45m%30s VS %-30s\033[m",
- user1->userid, user2->userid);
- } else if (line >= 3 && line <= 21) {
- outs(" ");
- for (i = 0; i < 9; i++) {
- j = board[RTL(line)][i];
- if ((line & 1) == 1 && j) {
- if (chc_selected &&
- chc_select.r == RTL(line) && chc_select.c == i)
- prints("%s%s\033[m",
- CHE_O(j) == 0 ? BLACK_REVERSE : RED_REVERSE,
- chess_str[CHE_O(j)][CHE_P(j)]);
- else
- prints("%s%s\033[m",
- CHE_O(j) == 0 ? BLACK_COLOR : RED_COLOR,
- chess_str[CHE_O(j)][CHE_P(j)]);
- } else
- prints("%c%c", chess_brd[line - 3][i * 4],
- chess_brd[line - 3][i * 4 + 1]);
- if (i != 8)
- prints("%c%c", chess_brd[line - 3][i * 4 + 2],
- chess_brd[line - 3][i * 4 + 3]);
- }
- outs(" ");
-
- if (line >= 3 && line < 3 + (int)dim(hint_str)) {
- outs(hint_str[line - 3]);
- } else if (line == SIDE_ROW) {
- prints("\033[1m你是%s%s\033[m",
- chc_my == 0 ? BLACK_COLOR : RED_COLOR,
- turn_str[chc_my]);
- } else if (line == TURN_ROW) {
- prints("%s%s\033[m",
- TURN_COLOR,
- chc_my == chc_turn ? "輪到你下棋了" : "等待對方下棋");
- } else if (line == STEP_ROW && !chc_firststep) {
- showstep(board);
- } else if (line == TIME_ROW) {
- prints("剩餘時間 %d:%02d", chc_lefttime / 60, chc_lefttime % 60);
- } else if (line == WARN_ROW) {
- outs(chc_warnmsg);
- } else if (line == MYWIN_ROW) {
- prints("\033[1;33m%12.12s "
- "\033[1;31m%2d\033[37m勝 "
- "\033[34m%2d\033[37m敗 "
- "\033[36m%2d\033[37m和\033[m",
- user1->userid,
- user1->win, user1->lose - 1, user1->tie);
- } else if (line == HISWIN_ROW) {
- prints("\033[1;33m%12.12s "
- "\033[1;31m%2d\033[37m勝 "
- "\033[34m%2d\033[37m敗 "
- "\033[36m%2d\033[37m和\033[m",
- user2->userid,
- user2->win, user2->lose - 1, user2->tie);
- }
- } else if (line == 2 || line == 22) {
- outs(" ");
- if (line == 2)
- for (i = 1; i <= 9; i++)
- prints("%s ", num_str[i]);
- else
- for (i = 9; i >= 1; i--)
- prints("%s ", num_str[i]);
- }
-}
-
-void
-chc_redraw(chcusr_t *user1, chcusr_t *user2, board_t board)
-{
- int i;
-
- for (i = 0; i <= 22; i++)
- chc_drawline(board, user1, user2, i);
-}
diff --git a/pttbbs/mbbsd/chc_net.c b/pttbbs/mbbsd/chc_net.c
deleted file mode 100644
index 5a8c5169..00000000
--- a/pttbbs/mbbsd/chc_net.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* $Id: chc_net.c,v 1.4 2002/07/21 09:26:02 in2 Exp $ */
-#include "bbs.h"
-typedef struct drc_t {
- rc_t from, to;
-} drc_t;
-
-int
-chc_recvmove(int s)
-{
- drc_t buf;
-
- if (read(s, &buf, sizeof(buf)) != sizeof(buf))
- return 1;
- chc_from = buf.from, chc_to = buf.to;
- return 0;
-}
-
-void
-chc_sendmove(int s)
-{
- drc_t buf;
-
- buf.from = chc_from, buf.to = chc_to;
- write(s, &buf, sizeof(buf));
-}
diff --git a/pttbbs/mbbsd/chc_play.c b/pttbbs/mbbsd/chc_play.c
deleted file mode 100644
index 36992ae8..00000000
--- a/pttbbs/mbbsd/chc_play.c
+++ /dev/null
@@ -1,312 +0,0 @@
-/* $Id$ */
-#include "bbs.h"
-typedef int (*play_func_t) (int, chcusr_t *, chcusr_t *, board_t, board_t);
-
-static int chc_ipass = 0, chc_hepass = 0;
-
-#define CHC_TIMEOUT 300
-#define SIDE_ROW 10
-#define TURN_ROW 11
-#define STEP_ROW 12
-#define TIME_ROW 13
-#define WARN_ROW 15
-#define MYWIN_ROW 17
-#define HISWIN_ROW 18
-
-static void
-chcusr_put(userec_t *userec, chcusr_t *user)
-{
- userec->chc_win = user->win;
- userec->chc_lose = user->lose;
- userec->chc_tie = user->tie;
-}
-
-static void
-chcusr_get(userec_t *userec, chcusr_t *user)
-{
- strlcpy(user->userid, userec->userid, sizeof(user->userid));
- user->win = userec->chc_win;
- user->lose = userec->chc_lose;
- user->tie = userec->chc_tie;
-}
-
-static int
-hisplay(int s, chcusr_t *user1, chcusr_t *user2, board_t board, board_t tmpbrd)
-{
- int start_time;
- int endgame = 0, endturn = 0;
-
- start_time = now;
- while (!endturn) {
- chc_lefttime = CHC_TIMEOUT - (now - start_time);
- if (chc_lefttime < 0) {
- chc_lefttime = 0;
-
- /* to make him break out igetkey() */
- chc_from.r = -2;
- chc_sendmove(s);
- }
- chc_drawline(board, user1, user2, TIME_ROW);
- move(1, 0);
- oflush();
- switch (igetkey()) {
- case 'q':
- endgame = 2;
- endturn = 1;
- break;
- case 'p':
- if (chc_hepass) {
- chc_from.r = -1;
- chc_sendmove(s);
- endgame = 3;
- endturn = 1;
- }
- break;
- case I_OTHERDATA:
- if (chc_recvmove(s)) { /* disconnect */
- endturn = 1;
- endgame = 1;
- } else {
- if (chc_from.r == -1) {
- chc_hepass = 1;
- strlcpy(chc_warnmsg, "\033[1;33m要求和局!\033[m", sizeof(chc_warnmsg));
- chc_drawline(board, user1, user2, WARN_ROW);
- } else {
- chc_from.r = 9 - chc_from.r, chc_from.c = 8 - chc_from.c;
- chc_to.r = 9 - chc_to.r, chc_to.c = 8 - chc_to.c;
- chc_cursor = chc_to;
- if (CHE_P(board[chc_to.r][chc_to.c]) == 1)
- endgame = 2;
- endturn = 1;
- chc_hepass = 0;
- chc_drawline(board, user1, user2, STEP_ROW);
- chc_movechess(board);
- chc_drawline(board, user1, user2, LTR(chc_from.r));
- chc_drawline(board, user1, user2, LTR(chc_to.r));
- }
- }
- break;
- }
- }
- return endgame;
-}
-
-static int
-myplay(int s, chcusr_t *user1, chcusr_t *user2, board_t board, board_t tmpbrd)
-{
- int ch, start_time;
- int endgame = 0, endturn = 0;
-
- chc_ipass = 0, chc_selected = 0;
- start_time = now;
- chc_lefttime = CHC_TIMEOUT - (now - start_time);
- bell();
- while (!endturn) {
- chc_drawline(board, user1, user2, TIME_ROW);
- chc_movecur(chc_cursor.r, chc_cursor.c);
- oflush();
- ch = igetkey();
- chc_lefttime = CHC_TIMEOUT - (now - start_time);
- if (chc_lefttime < 0)
- ch = 'q';
- switch (ch) {
- case I_OTHERDATA:
- if (chc_recvmove(s)) { /* disconnect */
- endgame = 1;
- endturn = 1;
- } else if (chc_from.r == -1 && chc_ipass) {
- endgame = 3;
- endturn = 1;
- }
- break;
- case KEY_UP:
- chc_cursor.r--;
- if (chc_cursor.r < 0)
- chc_cursor.r = BRD_ROW - 1;
- break;
- case KEY_DOWN:
- chc_cursor.r++;
- if (chc_cursor.r >= BRD_ROW)
- chc_cursor.r = 0;
- break;
- case KEY_LEFT:
- chc_cursor.c--;
- if (chc_cursor.c < 0)
- chc_cursor.c = BRD_COL - 1;
- break;
- case KEY_RIGHT:
- chc_cursor.c++;
- if (chc_cursor.c >= BRD_COL)
- chc_cursor.c = 0;
- break;
- case 'q':
- endgame = 2;
- endturn = 1;
- break;
- case 'p':
- chc_ipass = 1;
- chc_from.r = -1;
- chc_sendmove(s);
- strlcpy(chc_warnmsg, "\033[1;33m要求和棋!\033[m", sizeof(chc_warnmsg));
- chc_drawline(board, user1, user2, WARN_ROW);
- bell();
- break;
- case '\r':
- case '\n':
- case ' ':
- if (chc_selected) {
- if (chc_cursor.r == chc_select.r &&
- chc_cursor.c == chc_select.c) {
- chc_selected = 0;
- chc_drawline(board, user1, user2, LTR(chc_cursor.r));
- } else if (chc_canmove(board, chc_select, chc_cursor)) {
- if (CHE_P(board[chc_cursor.r][chc_cursor.c]) == 1)
- endgame = 1;
- chc_from = chc_select;
- chc_to = chc_cursor;
- if (!endgame) {
- memcpy(tmpbrd, board, sizeof(board_t));
- chc_movechess(tmpbrd);
- }
- if (endgame || !chc_iskfk(tmpbrd)) {
- chc_drawline(board, user1, user2, STEP_ROW);
- chc_movechess(board);
- chc_sendmove(s);
- chc_selected = 0;
- chc_drawline(board, user1, user2, LTR(chc_from.r));
- chc_drawline(board, user1, user2, LTR(chc_to.r));
- endturn = 1;
- } else {
- strlcpy(chc_warnmsg, "\033[1;33m不可以王見王\033[m", sizeof(chc_warnmsg));
- bell();
- chc_drawline(board, user1, user2, WARN_ROW);
- }
- }
- } else if (board[chc_cursor.r][chc_cursor.c] &&
- CHE_O(board[chc_cursor.r][chc_cursor.c]) == chc_turn) {
- chc_selected = 1;
- chc_select = chc_cursor;
- chc_drawline(board, user1, user2, LTR(chc_cursor.r));
- }
- break;
- }
- }
- return endgame;
-}
-
-static void
-mainloop(int s, chcusr_t *user1, chcusr_t *user2, board_t board, play_func_t play_func[2])
-{
- int endgame;
- board_t tmpbrd;
-
- play_func[chc_my] = myplay;
- if(s != 0)
- play_func[chc_my ^ 1] = hisplay;
- else /* 跟自己下棋 */
- play_func[chc_my ^ 1] = myplay;
-
- for (chc_turn = 1, endgame = 0; !endgame; chc_turn ^= 1) {
- chc_firststep = 0;
- chc_drawline(board, user1, user2, TURN_ROW);
- if (chc_ischeck(board, chc_turn)) {
- strlcpy(chc_warnmsg, "\033[1;31m將軍!\033[m", sizeof(chc_warnmsg));
- bell();
- } else
- chc_warnmsg[0] = 0;
- chc_drawline(board, user1, user2, WARN_ROW);
- endgame = play_func[chc_turn] (s, user1, user2, board, tmpbrd);
- }
-
- if (s != 0) {
- if (endgame == 1) {
- strlcpy(chc_warnmsg, "對方認輸了!", sizeof(chc_warnmsg));
- user1->win++;
- currutmp->chc_win++;
- } else if (endgame == 2) {
- strlcpy(chc_warnmsg, "你認輸了!", sizeof(chc_warnmsg));
- user1->lose++;
- currutmp->chc_lose++;
- } else {
- strlcpy(chc_warnmsg, "和棋", sizeof(chc_warnmsg));
- user1->tie++;
- currutmp->chc_tie++;
- }
- }
- else {
- strlcpy(chc_warnmsg, "結束打譜", sizeof(chc_warnmsg));
- }
- user1->lose--;
-
- // if not watching
- chcusr_put(&cuser, user1);
- passwd_update(usernum, &cuser);
- chc_drawline(board, user1, user2, WARN_ROW);
- bell();
- oflush();
-}
-
-static void
-chc_init(int s, chcusr_t *user1, chcusr_t *user2, board_t board)
-{
- userinfo_t *my = currutmp;
-
- setutmpmode(CHC);
- clear();
- chc_warnmsg[0] = 0;
- if(s != 0){ // XXX mateid -> user2
- chc_my = my->turn;
- chc_mateid = my->mateid;
- }
- else{
- chc_my = 1;
- chc_mateid = cuser.userid;
- }
- chc_firststep = 1;
- chc_init_board(board);
- chc_redraw(user1, user2, board);
- chc_cursor.r = 9, chc_cursor.c = 0;
- add_io(s, 0);
-
- if (my->turn)
- chc_recvmove(s);
-
- user1->lose++;
- // if not watching
- passwd_query(usernum, &xuser);
- chcusr_put(&xuser, user1);
- passwd_update(usernum, &xuser);
-
- if (!my->turn) {
- chc_sendmove(s);
- user2->lose++;
- }
- chc_redraw(user1, user2, board);
-}
-
-static void
-chc_userinit(char *userid1, char *userid2, chcusr_t *user1, chcusr_t *user2, play_func_t play_func[2])
-{
- getuser(userid1);
- chcusr_get(&xuser, user1);
-
- getuser(userid2);
- chcusr_get(&xuser, user2);
-}
-
-void
-chc(int s, int type)
-{
- board_t board;
- chcusr_t user1, user2;
- play_func_t play_func[2];
-
- chc_userinit(cuser.userid, currutmp->mateid, &user1, &user2, play_func);
- chc_init(s, &user1, &user2, board);
- mainloop(s, &user1, &user2, board, play_func);
- if (type == CHC_VERSUS)
- close(s);
- add_io(0, 0);
- if (chc_my)
- pressanykey();
-}
diff --git a/pttbbs/mbbsd/chc_rule.c b/pttbbs/mbbsd/chc_rule.c
deleted file mode 100644
index df7964a1..00000000
--- a/pttbbs/mbbsd/chc_rule.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/* $Id: chc_rule.c,v 1.4 2002/07/21 09:26:02 in2 Exp $ */
-#include "bbs.h"
-
-#define CENTER(a, b) (((a) + (b)) >> 1)
-
-void
-chc_init_board(board_t board)
-{
- memset(board, 0, sizeof(board_t));
- board[0][4] = CHE(1, chc_my ^ 1); /* 將 */
- board[0][3] = board[0][5] = CHE(2, chc_my ^ 1); /* 士 */
- board[0][2] = board[0][6] = CHE(3, chc_my ^ 1); /* 象 */
- board[0][0] = board[0][8] = CHE(4, chc_my ^ 1); /* 車 */
- board[0][1] = board[0][7] = CHE(5, chc_my ^ 1); /* 馬 */
- board[2][1] = board[2][7] = CHE(6, chc_my ^ 1); /* 包 */
- board[3][0] = board[3][2] = board[3][4] =
- board[3][6] = board[3][8] = CHE(7, chc_my ^ 1); /* 卒 */
-
- board[9][4] = CHE(1, chc_my); /* 帥 */
- board[9][3] = board[9][5] = CHE(2, chc_my); /* 仕 */
- board[9][2] = board[9][6] = CHE(3, chc_my); /* 相 */
- board[9][0] = board[9][8] = CHE(4, chc_my); /* 車 */
- board[9][1] = board[9][7] = CHE(5, chc_my); /* 傌 */
- board[7][1] = board[7][7] = CHE(6, chc_my); /* 炮 */
- board[6][0] = board[6][2] = board[6][4] =
- board[6][6] = board[6][8] = CHE(7, chc_my); /* 兵 */
-}
-
-void
-chc_movechess(board_t board)
-{
- board[chc_to.r][chc_to.c] = board[chc_from.r][chc_from.c];
- board[chc_from.r][chc_from.c] = 0;
-}
-
-static int
-dist(rc_t from, rc_t to, int rowcol)
-{
- int d;
-
- d = rowcol ? from.c - to.c : from.r - to.r;
- return d > 0 ? d : -d;
-}
-
-static int
-between(board_t board, rc_t from, rc_t to, int rowcol)
-{
- int i, rtv = 0;
-
- if (rowcol) {
- if (from.c > to.c)
- i = from.c, from.c = to.c, to.c = i;
- for (i = from.c + 1; i < to.c; i++)
- if (board[to.r][i])
- rtv++;
- } else {
- if (from.r > to.r)
- i = from.r, from.r = to.r, to.r = i;
- for (i = from.r + 1; i < to.r; i++)
- if (board[i][to.c])
- rtv++;
- }
- return rtv;
-}
-
-int
-chc_canmove(board_t board, rc_t from, rc_t to)
-{
- int i;
- int rd, cd, turn;
-
- rd = dist(from, to, 0);
- cd = dist(from, to, 1);
- turn = CHE_O(board[from.r][from.c]);
-
- /* general check */
- if (board[to.r][to.c] && CHE_O(board[to.r][to.c]) == turn)
- return 0;
-
- /* individual check */
- switch (CHE_P(board[from.r][from.c])) {
- case 1: /* 將 帥 */
- if (!(rd == 1 && cd == 0) &&
- !(rd == 0 && cd == 1))
- return 0;
- if ((turn == (chc_my ^ 1) && to.r > 2) ||
- (turn == chc_my && to.r < 7) ||
- to.c < 3 || to.c > 5)
- return 0;
- break;
- case 2: /* 士 仕 */
- if (!(rd == 1 && cd == 1))
- return 0;
- if ((turn == (chc_my ^ 1) && to.r > 2) ||
- (turn == chc_my && to.r < 7) ||
- to.c < 3 || to.c > 5)
- return 0;
- break;
- case 3: /* 象 相 */
- if (!(rd == 2 && cd == 2))
- return 0;
- if ((turn == (chc_my ^ 1) && to.r > 4) ||
- (turn == chc_my && to.r < 5))
- return 0;
- /* 拐象腿 */
- if (board[CENTER(from.r, to.r)][CENTER(from.c, to.c)])
- return 0;
- break;
- case 4: /* 車 */
- if (!(rd > 0 && cd == 0) &&
- !(rd == 0 && cd > 0))
- return 0;
- if (between(board, from, to, rd == 0))
- return 0;
- break;
- case 5: /* 馬 傌 */
- if (!(rd == 2 && cd == 1) &&
- !(rd == 1 && cd == 2))
- return 0;
- /* 拐馬腳 */
- if (rd == 2) {
- if (board[CENTER(from.r, to.r)][from.c])
- return 0;
- } else {
- if (board[from.r][CENTER(from.c, to.c)])
- return 0;
- }
- break;
- case 6: /* 包 炮 */
- if (!(rd > 0 && cd == 0) &&
- !(rd == 0 && cd > 0))
- return 0;
- i = between(board, from, to, rd == 0);
- if ((i > 1) ||
- (i == 1 && !board[to.r][to.c]) ||
- (i == 0 && board[to.r][to.c]))
- return 0;
- break;
- case 7: /* 卒 兵 */
- if (!(rd == 1 && cd == 0) &&
- !(rd == 0 && cd == 1))
- return 0;
- if (((turn == (chc_my ^ 1) && to.r < 5) ||
- (turn == chc_my && to.r > 4)) &&
- cd != 0)
- return 0;
- if ((turn == (chc_my ^ 1) && to.r < from.r) ||
- (turn == chc_my && to.r > from.r))
- return 0;
- break;
- }
- return 1;
-}
-
-static void
-findking(board_t board, int turn, rc_t * buf)
-{
- int i, r, c;
-
- r = (turn == (chc_my ^ 1)) ? 0 : 7;
- for (i = 0; i < 3; r++, i++)
- for (c = 3; c < 6; c++)
- if (CHE_P(board[r][c]) == 1 &&
- CHE_O(board[r][c]) == turn) {
- buf->r = r, buf->c = c;
- return;
- }
-}
-
-int
-chc_iskfk(board_t board)
-{
- rc_t from, to;
-
- findking(board, 0, &to);
- findking(board, 1, &from);
- if (from.c == to.c && between(board, from, to, 0) == 0)
- return 1;
- return 0;
-}
-
-int
-chc_ischeck(board_t board, int turn)
-{
- rc_t from, to;
-
- findking(board, turn, &to);
- for (from.r = 0; from.r < BRD_ROW; from.r++)
- for (from.c = 0; from.c < BRD_COL; from.c++)
- if (board[from.r][from.c] &&
- CHE_O(board[from.r][from.c]) != turn)
- if (chc_canmove(board, from, to))
- return 1;
- return 0;
-}
diff --git a/pttbbs/mbbsd/gomo.c b/pttbbs/mbbsd/gomo.c
index 0b64e709..1b95ef4d 100644
--- a/pttbbs/mbbsd/gomo.c
+++ b/pttbbs/mbbsd/gomo.c
@@ -1,6 +1,8 @@
/* $Id$ */
#include "bbs.h"
+#define QCAST int (*)(const void *, const void *)
+
static char *chess[] = {"●", "○"};
static int tick, lastcount, mylasttick, hislasttick;
@@ -11,6 +13,139 @@ typedef struct {
static Horder_t *v;
+/* pattern and advance map */
+
+static int
+intrevcmp(const void *a, const void *b)
+{
+ return (*(int *)b - *(int *)a);
+}
+
+// 以 (x,y) 為起點, 方向 (dx,dy), 傳回以 bit 表示相鄰哪幾格有子
+// 如 10111 表示該方向相鄰 1,2,3 有子, 4 空地
+// 最高位 1 表示對方的子, 或是牆
+/* x,y: 0..BRDSIZ-1 ; color: CBLACK,CWHITE ; dx,dy: -1,0,+1 */
+static int
+gomo_getindex(int x, int y, int color, int dx, int dy)
+{
+ int i, k, n;
+ for (n = -1, i = 0, k = 1; i < 5; i++, k*=2) {
+ x += dx;
+ y += dy;
+
+ if ((x < 0) || (x >= BRDSIZ) || (y < 0) || (y >= BRDSIZ)) {
+ n += k;
+ break;
+ } else if (ku[x][y] != BBLANK) {
+ n += k;
+ if (ku[x][y] != color)
+ break;
+ }
+ }
+
+ if (i >= 5)
+ n += k;
+
+ return n;
+}
+
+int
+chkwin(int style, int limit)
+{
+ if (style == 0x0c)
+ return 1 /* style */ ;
+ else if (limit == 0) {
+ if (style == 0x0b)
+ return 1 /* style */ ;
+ return 0;
+ }
+ if ((style < 0x0c) && (style > 0x07))
+ return -1 /* -style */ ;
+ return 0;
+}
+
+/* x,y: 0..BRDSIZ-1 ; color: CBLACK,CWHITE ; limit:1,0 ; dx,dy: 0,1 */
+static int
+dirchk(int x, int y, int color, int limit, int dx, int dy)
+{
+ int le, ri, loc, style = 0;
+
+ le = gomo_getindex(x, y, color, -dx, -dy);
+ ri = gomo_getindex(x, y, color, dx, dy);
+
+ loc = (le > ri) ? (((le * (le + 1)) >> 1) + ri) :
+ (((ri * (ri + 1)) >> 1) + le);
+
+ style = pat[loc];
+
+ if (limit == 0)
+ return (style & 0x0f);
+
+ style >>= 4;
+
+ if ((style == 3) || (style == 2)) {
+ int i, n = 0, tmp, nx, ny;
+
+ n = adv[loc / 2];
+
+ if(loc%2==0)
+ n/=16;
+ else
+ n%=16;
+
+ ku[x][y] = color;
+
+ for (i = 0; i < 2; i++) {
+ if ((tmp = (i == 0) ? (-(n >> 2)) : (n & 3)) != 0) {
+ nx = x + (le > ri ? 1 : -1) * tmp * dx;
+ ny = y + (le > ri ? 1 : -1) * tmp * dy;
+
+ if ((dirchk(nx, ny, color, 0, dx, dy) == 0x06) &&
+ (chkwin(getstyle(nx, ny, color, limit), limit) >= 0))
+ break;
+ }
+ }
+ if (i >= 2)
+ style = 0;
+ ku[x][y] = BBLANK;
+ }
+ return style;
+}
+
+/* 例外=F 錯誤=E 有子=D 連五=C 連六=B 雙四=A 四四=9 三三=8 */
+/* 四三=7 活四=6 斷四=5 死四=4 活三=3 斷三=2 保留=1 無效=0 */
+
+/* x,y: 0..BRDSIZ-1 ; color: CBLACK,CWHITE ; limit: 1,0 */
+int
+getstyle(int x, int y, int color, int limit)
+{
+ int i, j, dir[4], style;
+
+ if ((x < 0) || (x >= BRDSIZ) || (y < 0) || (y >= BRDSIZ))
+ return 0x0f;
+ if (ku[x][y] != BBLANK)
+ return 0x0d;
+
+ // (-1,1), (0,1), (1,0), (1,1)
+ for (i = 0; i < 4; i++)
+ dir[i] = dirchk(x, y, color, limit, i ? (i >> 1) : -1, i ? (i & 1) : 1);
+
+ qsort(dir, 4, sizeof(int), (QCAST)intrevcmp);
+
+ if ((style = dir[0]) >= 2) {
+ for (i = 1, j = 6 + (limit ? 1 : 0); i < 4; i++) {
+ if ((style > j) || (dir[i] < 2))
+ break;
+ if (dir[i] > 3)
+ style = 9;
+ else if ((style < 7) && (style > 3))
+ style = 7;
+ else
+ style = 8;
+ }
+ }
+ return style;
+}
static void
HO_init(Horder_t *pool)
{
diff --git a/pttbbs/mbbsd/gomo1.c b/pttbbs/mbbsd/gomo1.c
deleted file mode 100644
index 49d484a5..00000000
--- a/pttbbs/mbbsd/gomo1.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/* $Id$ */
-#include "bbs.h"
-
-#define QCAST int (*)(const void *, const void *)
-
-/* pattern and advance map */
-
-static int
-intrevcmp(const void *a, const void *b)
-{
- return (*(int *)b - *(int *)a);
-}
-
-// 以 (x,y) 為起點, 方向 (dx,dy), 傳回以 bit 表示相鄰哪幾格有子
-// 如 10111 表示該方向相鄰 1,2,3 有子, 4 空地
-// 最高位 1 表示對方的子, 或是牆
-/* x,y: 0..BRDSIZ-1 ; color: CBLACK,CWHITE ; dx,dy: -1,0,+1 */
-static int
-gomo_getindex(int x, int y, int color, int dx, int dy)
-{
- int i, k, n;
- for (n = -1, i = 0, k = 1; i < 5; i++, k*=2) {
- x += dx;
- y += dy;
-
- if ((x < 0) || (x >= BRDSIZ) || (y < 0) || (y >= BRDSIZ)) {
- n += k;
- break;
- } else if (ku[x][y] != BBLANK) {
- n += k;
- if (ku[x][y] != color)
- break;
- }
- }
-
- if (i >= 5)
- n += k;
-
- return n;
-}
-
-int
-chkwin(int style, int limit)
-{
- if (style == 0x0c)
- return 1 /* style */ ;
- else if (limit == 0) {
- if (style == 0x0b)
- return 1 /* style */ ;
- return 0;
- }
- if ((style < 0x0c) && (style > 0x07))
- return -1 /* -style */ ;
- return 0;
-}
-
-/* x,y: 0..BRDSIZ-1 ; color: CBLACK,CWHITE ; limit:1,0 ; dx,dy: 0,1 */
-static int
-dirchk(int x, int y, int color, int limit, int dx, int dy)
-{
- int le, ri, loc, style = 0;
-
- le = gomo_getindex(x, y, color, -dx, -dy);
- ri = gomo_getindex(x, y, color, dx, dy);
-
- loc = (le > ri) ? (((le * (le + 1)) >> 1) + ri) :
- (((ri * (ri + 1)) >> 1) + le);
-
- style = pat[loc];
-
- if (limit == 0)
- return (style & 0x0f);
-
- style >>= 4;
-
- if ((style == 3) || (style == 2)) {
- int i, n = 0, tmp, nx, ny;
-
- n = adv[loc / 2];
-
- if(loc%2==0)
- n/=16;
- else
- n%=16;
-
- ku[x][y] = color;
-
- for (i = 0; i < 2; i++) {
- if ((tmp = (i == 0) ? (-(n >> 2)) : (n & 3)) != 0) {
- nx = x + (le > ri ? 1 : -1) * tmp * dx;
- ny = y + (le > ri ? 1 : -1) * tmp * dy;
-
- if ((dirchk(nx, ny, color, 0, dx, dy) == 0x06) &&
- (chkwin(getstyle(nx, ny, color, limit), limit) >= 0))
- break;
- }
- }
- if (i >= 2)
- style = 0;
- ku[x][y] = BBLANK;
- }
- return style;
-}
-
-/* 例外=F 錯誤=E 有子=D 連五=C 連六=B 雙四=A 四四=9 三三=8 */
-/* 四三=7 活四=6 斷四=5 死四=4 活三=3 斷三=2 保留=1 無效=0 */
-
-/* x,y: 0..BRDSIZ-1 ; color: CBLACK,CWHITE ; limit: 1,0 */
-int
-getstyle(int x, int y, int color, int limit)
-{
- int i, j, dir[4], style;
-
- if ((x < 0) || (x >= BRDSIZ) || (y < 0) || (y >= BRDSIZ))
- return 0x0f;
- if (ku[x][y] != BBLANK)
- return 0x0d;
-
- // (-1,1), (0,1), (1,0), (1,1)
- for (i = 0; i < 4; i++)
- dir[i] = dirchk(x, y, color, limit, i ? (i >> 1) : -1, i ? (i & 1) : 1);
-
- qsort(dir, 4, sizeof(int), (QCAST)intrevcmp);
-
- if ((style = dir[0]) >= 2) {
- for (i = 1, j = 6 + (limit ? 1 : 0); i < 4; i++) {
- if ((style > j) || (dir[i] < 2))
- break;
- if (dir[i] > 3)
- style = 9;
- else if ((style < 7) && (style > 3))
- style = 7;
- else
- style = 8;
- }
- }
- return style;
-}
diff --git a/pttbbs/mbbsd/mbbsd.c b/pttbbs/mbbsd/mbbsd.c
index 5cf1fb90..7968860e 100644
--- a/pttbbs/mbbsd/mbbsd.c
+++ b/pttbbs/mbbsd/mbbsd.c
@@ -249,7 +249,7 @@ dosearchuser(char *userid)
return usernum;
}
-static void
+void
talk_request(int sig)
{
bell();
diff --git a/pttbbs/mbbsd/name.c b/pttbbs/mbbsd/name.c
index b16f19ef..5c04a54a 100644
--- a/pttbbs/mbbsd/name.c
+++ b/pttbbs/mbbsd/name.c
@@ -1,4 +1,4 @@
-/* $Id: name.c,v 1.16 2003/02/20 16:12:13 in2 Exp $ */
+/* $Id$ */
#include "bbs.h"
static word_t *current = NULL;
diff --git a/pttbbs/mbbsd/othello.c b/pttbbs/mbbsd/othello.c
index 6f6d69ab..96fea2e2 100644
--- a/pttbbs/mbbsd/othello.c
+++ b/pttbbs/mbbsd/othello.c
@@ -1,4 +1,4 @@
-/* $Id: othello.c,v 1.5 2002/07/21 09:26:02 in2 Exp $ */
+/* $Id$ */
#include "bbs.h"
#define LOGFILE "etc/othello.log"
diff --git a/pttbbs/mbbsd/talk.c b/pttbbs/mbbsd/talk.c
index 2ef59c86..7ccd1e87 100644
--- a/pttbbs/mbbsd/talk.c
+++ b/pttbbs/mbbsd/talk.c
@@ -39,6 +39,8 @@ static char save_page_requestor[40];
static char page_requestor[40];
static FILE *flog;
+userinfo_t *uip;
+
int
iswritable_stat(userinfo_t * uentp, int fri_stat)
{
@@ -1187,8 +1189,8 @@ int make_connection_to_somebody(userinfo_t *uin, int timeout){
return sock;
}
-static void
-my_talk(userinfo_t * uin, int fri_stat)
+void
+my_talk(userinfo_t * uin, int fri_stat, char defact)
{
int sock, msgsock, error = 0, ch;
pid_t pid;
@@ -1197,6 +1199,7 @@ my_talk(userinfo_t * uin, int fri_stat)
unsigned char mode0 = currutmp->mode;
+ genbuf[0] = defact;
ch = uin->mode;
strlcpy(currauthor, uin->userid, sizeof(currauthor));
@@ -2215,7 +2218,7 @@ userlist(void)
move(3, 0);
if (uentp->pid != currpid &&
strcmp(uentp->userid, cuser.userid) != 0) {
- my_talk(uentp, fri_stat);
+ my_talk(uentp, fri_stat, 0);
}
else{
self_play(uentp, fri_stat);
@@ -2522,12 +2525,12 @@ t_talk()
}
if ((uentp = (userinfo_t *) search_ulistn(tuid, unum)))
- my_talk(uentp, friend_stat(currutmp, uentp));
+ my_talk(uentp, friend_stat(currutmp, uentp), 0);
return 0;
}
-static int
+int
reply_connection_request(userinfo_t *uip)
{
int a;
@@ -2561,7 +2564,6 @@ reply_connection_request(userinfo_t *uip)
}
/* 有人來串門子了,回應呼叫器 */
-static userinfo_t *uip;
void
talkreply(void)
{
diff --git a/pttbbs/sample/etc/chess/1.poem b/pttbbs/sample/etc/chess/1.poem
new file mode 100644
index 00000000..f50247ab
--- /dev/null
+++ b/pttbbs/sample/etc/chess/1.poem
@@ -0,0 +1,10 @@
+象弈 南宋 劉克莊
+
+ 或遲如圍莒,或速如入蔡。
+
+ 遠炮勿虛發,冗卒要精汰。
+
+ 負非由寡少,勝豈繫強大?
+
+ 昆陽以象奔,陳濤以車敗。
+
diff --git a/pttbbs/sample/etc/chess/10.poem b/pttbbs/sample/etc/chess/10.poem
new file mode 100644
index 00000000..b9dc2107
--- /dev/null
+++ b/pttbbs/sample/etc/chess/10.poem
@@ -0,0 +1,10 @@
+無題 明 明太子朱高熾
+
+ 二國爭強各用兵,擺成隊伍定輸贏。
+
+ 馬行曲路當先道,將守深宮戒遠征。
+
+ 乘險出車收敗卒,隔河飛炮下重城。
+
+ 等閒識得軍情事,一著功成見太平。
+
diff --git a/pttbbs/sample/etc/chess/11.poem b/pttbbs/sample/etc/chess/11.poem
new file mode 100644
index 00000000..01331372
--- /dev/null
+++ b/pttbbs/sample/etc/chess/11.poem
@@ -0,0 +1,6 @@
+無題 不明
+
+ 清風明月之夜,詩歌唱詠;
+
+ 古松流水之間,敲棋品茗。
+
diff --git a/pttbbs/sample/etc/chess/12.poem b/pttbbs/sample/etc/chess/12.poem
new file mode 100644
index 00000000..53a68b72
--- /dev/null
+++ b/pttbbs/sample/etc/chess/12.poem
@@ -0,0 +1,6 @@
+諷宋薛昂處士負棋作詩 不明
+
+ 好笑當年薛乞兒,荊公座上賭新詩,
+
+ 而今又向江東去,奉勸先生莫下棋。
+
diff --git a/pttbbs/sample/etc/chess/13.poem b/pttbbs/sample/etc/chess/13.poem
new file mode 100644
index 00000000..01331372
--- /dev/null
+++ b/pttbbs/sample/etc/chess/13.poem
@@ -0,0 +1,6 @@
+無題 不明
+
+ 清風明月之夜,詩歌唱詠;
+
+ 古松流水之間,敲棋品茗。
+
diff --git a/pttbbs/sample/etc/chess/14.poem b/pttbbs/sample/etc/chess/14.poem
new file mode 100644
index 00000000..d41950e8
--- /dev/null
+++ b/pttbbs/sample/etc/chess/14.poem
@@ -0,0 +1,10 @@
+無題 明 明象棋高手李開先 村翁
+
+ 小有兼逢大有年,田家多穫即為賢。
+
+ 有時撒網為漁父,日常登床作睡仙。
+
+ 破局棋堆隨手應,無弦琴不用音傳。
+
+ 一身之外無所慕,下有青山上碧天。
+
diff --git a/pttbbs/sample/etc/chess/15.poem b/pttbbs/sample/etc/chess/15.poem
new file mode 100644
index 00000000..139597f9
--- /dev/null
+++ b/pttbbs/sample/etc/chess/15.poem
@@ -0,0 +1,2 @@
+
+
diff --git a/pttbbs/sample/etc/chess/16.poem b/pttbbs/sample/etc/chess/16.poem
new file mode 100644
index 00000000..139597f9
--- /dev/null
+++ b/pttbbs/sample/etc/chess/16.poem
@@ -0,0 +1,2 @@
+
+
diff --git a/pttbbs/sample/etc/chess/2.poem b/pttbbs/sample/etc/chess/2.poem
new file mode 100644
index 00000000..119e98ae
--- /dev/null
+++ b/pttbbs/sample/etc/chess/2.poem
@@ -0,0 +1,10 @@
+棋詩 明 曾子棨
+
+ 兩軍對敵立雙營,坐運神機決死生。
+
+ 千里封疆馳鐵馬,一川波浪動金兵。
+
+ 虞姬歌舞悲垓下,反將旌旗逼楚城。
+
+ 興盡計窮征戰罷,松蔭花影滿棋秤。
+
diff --git a/pttbbs/sample/etc/chess/3.poem b/pttbbs/sample/etc/chess/3.poem
new file mode 100644
index 00000000..d69636b7
--- /dev/null
+++ b/pttbbs/sample/etc/chess/3.poem
@@ -0,0 +1,6 @@
+觀棋 清 袁枚
+
+ 攏袖觀棋有所思,分明楚漢兩軍峙。
+
+ 非常喜歡非常惱,不著棋人總不如。
+
diff --git a/pttbbs/sample/etc/chess/4.poem b/pttbbs/sample/etc/chess/4.poem
new file mode 100644
index 00000000..f86edc12
--- /dev/null
+++ b/pttbbs/sample/etc/chess/4.poem
@@ -0,0 +1,10 @@
+和春深 唐 白居易
+
+ 何處深為好,春到博弈家。
+
+ 一先爭破眼,六聚斗成花,
+
+ 鼓應投壹馬,兵沖象戲車。
+
+ 評棋局上事,最妙是長斜。
+
diff --git a/pttbbs/sample/etc/chess/5.poem b/pttbbs/sample/etc/chess/5.poem
new file mode 100644
index 00000000..cffd55e1
--- /dev/null
+++ b/pttbbs/sample/etc/chess/5.poem
@@ -0,0 +1,8 @@
+無題 宋 王安石
+
+ 飄飄凌雲志,強御莫能懾;
+
+ 忘情塞上馬,適志夢中蝶;
+
+ 經論安所施,有寓聊自愜。
+
diff --git a/pttbbs/sample/etc/chess/6.poem b/pttbbs/sample/etc/chess/6.poem
new file mode 100644
index 00000000..00c4cff8
--- /dev/null
+++ b/pttbbs/sample/etc/chess/6.poem
@@ -0,0 +1,6 @@
+無題 呂洞賓
+
+ 教著殘局山月曉,
+
+ 一聲長嘯海天秋。
+
diff --git a/pttbbs/sample/etc/chess/7.poem b/pttbbs/sample/etc/chess/7.poem
new file mode 100644
index 00000000..b525cba0
--- /dev/null
+++ b/pttbbs/sample/etc/chess/7.poem
@@ -0,0 +1,10 @@
+吊棋 明 錢鶴灘
+
+ 敲棋終日與偏幽,誰道今朝結父仇。
+
+ 兵足下河車不救,將軍落水士難留。
+
+ 馬行千里隨波去,象渡三江逐淚流。
+
+ 炮響一聲驚霹靂,臥龍投起碧雲浮。
+
diff --git a/pttbbs/sample/etc/chess/8.poem b/pttbbs/sample/etc/chess/8.poem
new file mode 100644
index 00000000..01360b29
--- /dev/null
+++ b/pttbbs/sample/etc/chess/8.poem
@@ -0,0 +1,10 @@
+詠象戲 北宋 程顥
+
+ 大都博弈皆戲劇,象戲翻能學用兵。
+
+ 車馬尚存周戰法,偏裨兼備漢官名。
+
+ 中軍八面將軍重,河外尖斜步卒輕。
+
+ 卻憑紋楸聊自笑,雄如劉項亦間爭。
+
diff --git a/pttbbs/sample/etc/chess/9.poem b/pttbbs/sample/etc/chess/9.poem
new file mode 100644
index 00000000..01331372
--- /dev/null
+++ b/pttbbs/sample/etc/chess/9.poem
@@ -0,0 +1,6 @@
+無題 不明
+
+ 清風明月之夜,詩歌唱詠;
+
+ 古松流水之間,敲棋品茗。
+