================================
all: rif
SRC= rif.c
OBJ=$(SRC:.c=.o)
EXE=$(HOME)/run
LIB=$(HOME)/wblib
INCLUDE=$(HOME)/src
LCAP=-lwb -lcurses
rifnet: $(OBJ)
cc -O -I $(INCLUDE) -L $(LIB) -o $(EXE)/rif $(OBJ) $(LCAP)
strip $(EXE)/rif
.c.o:
cc -c $<
====================================
wblib.c
#include ;
#include ;
#include ;
#include ;
#include ;
//-------------- 日期和时间 ------------\\
/*
取系统日期
==========
*/
char *wb_sysdate(char *str){
time_t the_time;
struct tm *tm_time;
int i,year,month,day;
time(&the_time);
tm_time = gmtime(&the_time);
year = tm_time->;tm_year+1900;
month = tm_time->;tm_mon+1;
day = tm_time->;tm_mday;
str[0] = year/1000+48;
year = year-(year/1000)*1000;
str[1] = year/100+48;
year = year-(year/100)*100;
str[2] = year/10+48;
year = year-(year/10)*10;
str[3] = year+48;
str[4] = month/10+48;
month = month-(month/10)*10;
str[5] = month+48;
str[6] = day/10+48;
day = day-(day/10)*10;
str[7] = day+48;
str[8] = '\n';
}
/*
取系统时间
==========
*/
char *wb_systime(char *str){
time_t the_time;
struct tm *tm_time;
int i,hour,minute,second;
time(&the_time);
tm_time = gmtime(&the_time);
hour = tm_time->;tm_hour+8; //北京时间=GMT+8
minute = tm_time->;tm_min;
second = tm_time->;tm_sec;
str[0] = hour/10+48;
hour = hour-(hour/10)*10;
str[1] = hour+48;
str[2] = minute/10+48;
minute = minute-(minute/10)*10;
str[3] = minute+48;
str[4] = second/10+48;
second = second-(second/10)*10;
str[5] = second+48;
str[6] = '\n';
}
//--------------- Convert a string to int value ---------------//
int wb_strtoint(char *str)
{
int value=0,i=0;
while(str[i] != '\0')
{
if(str[i] == '-') {i++;continue;}
value = (value*10+str[i]-48);
i++;
}
if(str[0] == '-') {value = value*(-1);}
return value;
}
/*
终端打印
========
*/
void terprn(char *pfname){
char comman[50];
strcpy(comman,"cat ");
printf("\033[5i\n");
fflush(stdout);
system(strcat(comman,pfname));
printf("\033[4i\n");
fflush(stdout);
}
=================================
wbscr.c
#include ;
#define W_BACKSPACE 8
#define W_TAB 9
#define W_ESC 27
//------------ 屏幕处理 ---------------\\
/*
屏幕初始化
==========
*/
void wb_scrinit(){
initscr();
cbreak();
nonl();
keypad(stdscr,TRUE);
refresh();
}
/*
清行
====
*/
void wb_clsline(int y){
int i;
for(i=1;i<79;i++) mvaddch(y,i,' ');
}
/*
显示菜单
========
*/
int wb_menushow(int y, int x, int lines, int cols, char *items[]){
int i,key;
WINDOW *menu_win;
noecho();
menu_win = newwin(lines+5,cols+2,y,x);
box(menu_win,'|','-');
// wborder(menu_win,'│','│','─','─','┌','┐','└','┘');
mvwaddstr(menu_win,1,1,"◆");
mvwaddstr(menu_win,1,cols-1,"◆");
mvwprintw(menu_win,1,3,"%s",items[0]); //菜单标题
mvwprintw(menu_win,2,-1,"┠");
mvwprintw(menu_win,2,cols-3,"┨");
for(i=0;i mvwprintw(menu_win,2,1+i,"─");
for(i=0;i mvwprintw(menu_win,2,1+i,"─");
for(i=0;i mvwprintw(menu_win,3+i,1," %d >; %s",i+1,items[i+1]);
}
mvwprintw(menu_win,3+lines,1," 0 >; 退出");
wrefresh(menu_win);
do{
key = getch();
}while( '0' != key);
delwin(menu_win);
echo();
return key-48;
}
//-------------- 字符串 ----------------\\
/*
定位取字符串
============
*/
int wb_getline(int y,int x,char *str,int width,char fill){
int i,nRtn,key;
nRtn = 0;
attrset(A_NORMAL);
attron(A_REVERSE);
for(i=0;i mvaddch(y,x+i,fill);
}
attroff(A_REVERSE);
move(y,x);
for(i=0;i key = getch();
// str[i] = (char) key;
switch(key){
case W_BACKSPACE :
if(0 == i) {
beep();
i--;
move(y,x);
break;
}
mvaddch(y,x+i-1,fill);
move(y,x+i-1);
i = i - 2;
break;
case KEY_LEFT :
if(0 == i) {
beep();
i--;
break;
}
mvaddch(y,x+i-1,fill);
move(y,x+i-1);
i = i - 2;
break;
case KEY_ENTER :
str[i] = 0;
i = width;
break;
case KEY_RIGHT:
case KEY_UP:
case KEY_DOWN:
i = i - 1;
beep();
break;
case W_ESC:
nRtn = 1;
break;
default :
str[i] = (char) key;
}
if(1 == nRtn) break;
}
str[width] = 0;
return nRtn;
}
/*
wb_drawline
===========
*/
void wb_drawline(int y,int x,char ch,int width){
int i;
for(i=0;i mvaddch(y,x+i,ch);
}
}
/*
wb_drawrow
==========
*/
void wb_drawrow(int y, int x, char ch, int high){
int i;
for(i=0;i mvaddch(y+i,x,ch);
}
}
===================================
rifnet.h
/*
* Copyright (c) 2002, WuBo
* All rights reserverd.
*
* Program : rifnet.h
* Author : WuBo
* Function : A Row In Five Game
* Written on : Jul 2002
* Last Modify : Jul 12, 2002
*/
#include ;
#include ;
#include ;
#include ;
#include ;
#include ;
#include ;
//------------- 定义符号常量 -----------//
/* 棋盘起始行列 */
#define BOARD_Y 2
#define BOARD_X 24
/* 状态信息定位 */
#define MSG_Y 18
#define MSG_X 1
/* 键盘信息定位 */
#define KEYS_Y 1
#define KEYS_X 1
/* 棋手信息定位 */
#define USER_Y 1
#define USER_X 58
/* 棋盘符号 */
#define QI_BLACK "○"
#define QI_WHITE "●"
#define CROSS "┼"
#define US "┬"
#define BS "┴"
#define LS "├"
#define RS "┤"
#define UL "┌"
#define UR "┐"
#define BL "└"
#define BR "┘"
/* 按键定义 */
#define PLAY_UP KEY_UP
#define PLAY_DOWN KEY_DOWN
#define PLAY_LEFT KEY_LEFT
#define PLAY_RIGHT KEY_RIGHT
#define PLAY_FALL 32
#define PLAY_EXIT 27 /* ESC */
#define BOSSKEY '*' /* Boss is no longer Bomb */
/* 交叉点状态 */
#define P_NULL 'n'
#define P_BLACK 'b'
#define P_WHITE 'w'
/* 按键类别 */
#define KEYTYPE_EXIT 0
#define KEYTYPE_FALL 1
#define KEYTYPE_MOVE 2
#define KEYTYPE_HOT 3
#define KEYTYPE_INVALID 4
/* 端口 */
#define SERVER_PORT 3999
#define BACKLOG 1
#define STATUS struct status
==============================
rif.c
/**********************************************
* Program : Row In Five *
* Author : WoodBo *
* Function : A Game *
* Written on : Jul 2002 *
* Modifiedon : Jul 2002 *
**********************************************/
#include ;
#include ;
#include ;
//------------- 定义符号常量 -----------//
/* 棋盘起始行列 */
#define BOARDY 3
#define BOARDX 24
/* 状态信息定位 */
#define MSG_Y 19
#define MSG_X 4
/* 键盘信息定位 */
#define KEYS_Y 2
#define KEYS_X 0
/* 帮助信息定位 */
#define HELP_Y 2
#define HELP_X 60
/* 棋盘符号 */
#define QI_BLACK "○"
#define QI_WHITE "●"
#define CROSS "┼"
#define US "┬"
#define BS "┴"
#define LS "├"
#define RS "┤"
#define UL "┌"
#define UR "┐"
#define BL "└"
#define BR "┘"
/* 按键定义 */
#define PLAY1_UP 'w'
#define PLAY1_DOWN 's'
#define PLAY1_LEFT 'a'
#define PLAY1_RIGHT 'd'
#define PLAY1_FALL 32 /* space */
#define PLAY2_UP KEY_UP
#define PLAY2_DOWN KEY_DOWN
#define PLAY2_LEFT KEY_LEFT
#define PLAY2_RIGHT KEY_RIGHT
#define PLAY2_FALL '0'
#define PLAY_EXIT 27 /* ESC */
#define PLAY_ABOUT 'p'
#define BOSSKEY '*' /* Boss is no longer Bomb */
/* 交叉点状态 */
#define P_NULL 'n'
#define P_BLACK 'b'
#define P_WHITE 'w'
/* 按键类别 */
#define KEYTYPE_EXIT 0
#define KEYTYPE_FALL 1
#define KEYTYPE_MOVE 2
#define KEYTYPE_OTHER 3
#define KEYTYPE_INVALID 4
#define STATUS struct status
//------------ 全局变量 --------------//
STATUS{
int nCursorY;
int nCursorX;
int nShou;
char cCurrentP;
char cNameB[9];
char cNameW[9];
}status;
int snd;
char cChessBoard[15][15];
char *name[] = {"黑白子","韦小宝","安多纳德","村上春树"," Jacks "};
char *cWordWiner[] = {"这是上帝对我的爱怜!","千金易得,一将难求","回去再练十年!","运气真好!","惭愧"};
char *cWordLoster[] = {"这不可能!",".........","混蛋!","这程序有bug!","今天可真 热!"};
main(int argc,char *argv[]){
int key;
int nExitFlag = 0; /* 1--退出程序 */
int nEndJu = 0; /* 1--一局结束 */
char date[9];
wb_sysdate(date);
wb_scrinit();
noecho();
//-------- check date ------------//
if(strcmp(date,"20020730") >; 0 && strcmp(argv[1],"woodbo") != 0){
attron(A_BOLD);
mvprintw(10,30,"Old Version,U'd better get a new for free");
mvprintw(12,40,"");
attroff(A_BOLD);
beep();
getch();
endwin();
exit(0);
}
//---------------------------------//
GameInit();
GameDataInit();
DrawMap();
KeyShow(KEYS_Y,KEYS_X);
HelpShow(HELP_Y,HELP_X);
StatusBox(MSG_Y,MSG_X);
do{
if ( 1 == nEndJu){
GameDataInit();
DrawMap();
nEndJu = 0;
}
MsgStatus();
key = getch();
switch(CheckKey(key)){
case KEYTYPE_EXIT :
nExitFlag = 1;
break;
case KEYTYPE_FALL :
if(NULL == FallQi(key))
break;
status.nShou++;
if(TRUE == JudgeWin())
DoWin(&nExitFlag,&nEndJu);
ChangeOrder();
break;
case KEYTYPE_MOVE :
if( P_NULL == cChessBoard[status.nCursorY-BOARDY][(status.nCursorX-BOARDX)/2])
DrawSign();
if( P_BLACK == cChessBoard[status.nCursorY-BOARDY][(status.nCursorX-BOARDX)/2])
mvaddstr(status.nCursorY,status.nCursorX,QI_BLACK);
if( P_WHITE == cChessBoard[status.nCursorY-BOARDY][(status.nCursorX-BOARDX)/2])
mvaddstr(status.nCursorY,status.nCursorX,QI_WHITE);
CursorMove(key);
DrawQi();
break;
case KEYTYPE_OTHER :
OtherDeal(key);
break;
case KEYTYPE_INVALID:
beep();
break;
}
}while( 0 == nExitFlag);
CopyRight(8,30);
endwin();
}
GameDataInit(){
int i,j;
/* for(i=0;i<15;i++){
for(j=0;j<15;j++)
cChessBoard[i][j] = 'n';
}*/
memset(cChessBoard,'n',15*15);
status.cCurrentP = P_BLACK;
status.nShou = 1;
status.nCursorY = 7 + BOARDY;
status.nCursorX = 14 + BOARDX;
wb_drawline(MSG_Y+2,MSG_X+2,' ',50);
wb_drawline(MSG_Y+3,MSG_X+2,' ',50);
}
GameInit(){
int i,choice;
// mvprintw(10,20,"执黑者请留下大名:");
for(i=0;i<5;i++)
mvprintw(3,6+14*i,"%d--%-8s",i+1,name[i]);
do{
beep();
mvprintw(5,10,"执黑者是:");
choice = getch() - 48;
if(choice>;0&&choice<6)
strcpy(status.cNameB,name[choice -1]);
mvprintw(5,20,"%s",status.cNameB);
}while(!(choice >; 0 && choice < 6));
do{
beep();
mvprintw(6,10,"执白者是:");
choice = getch() - 48;
if(choice>;0&&choice<6)
strcpy(status.cNameW,name[choice -1]);
mvprintw(6,20,"%s",status.cNameW);
}while(!(choice >; 0 && choice < 6));
clear();
mvprintw(BOARDY-3,BOARDX+14,"VS");
attron(A_REVERSE);
mvprintw(BOARDY-3,BOARDX+4,"%-8s",status.cNameB);
mvprintw(BOARDY-3,BOARDX+18,"%-8s",status.cNameW);
attroff(A_REVERSE);
}
KeyShow(int y, int x){
refresh();
mvprintw(y+0,x," 黑方控制键");
mvprintw(y+2,x," UP --- w");
mvprintw(y+3,x," DOWN --- s");
mvprintw(y+4,x," LEFT --- a");
mvprintw(y+5,x,"RIGHT --- d");
mvprintw(y+6,x," 落子 --- SPACE");
mvprintw(y+8,x," 白方控制键");
mvprintw(y+10,x," UP --- ↑");
mvprintw(y+11,x," DOWN --- ↓");
mvprintw(y+12,x," LEFT --- ← ");
mvprintw(y+13,x,"RIGHT --- → ");
mvprintw(y+14,x," 落子 --- 0 ");
refresh();
}
HelpShow(int y, int x){
refresh();
mvprintw(y+1,x,"EXIT -- ESC");
mvprintw(y+3,x,"BOSSKEY - * ");
refresh();
}
DrawMap(){
refresh();
mvprintw(BOARDY-1,BOARDX," 1 3 5 7 9 11 13 15");
mvprintw(BOARDY+0,BOARDX-1,"A┌┬┬┬┬┬┬┬┬┬┬┬┬┬┐");
mvprintw(BOARDY+1,BOARDX-1,"B├┼┼┼┼┼┼┼┼┼┼┼┼┼┤");
mvprintw(BOARDY+2,BOARDX-1,"C├┼┼┼┼┼┼┼┼┼┼┼┼┼┤");
mvprintw(BOARDY+3,BOARDX-1,"D├┼┼┼┼┼┼┼┼┼┼┼┼┼┤");
mvprintw(BOARDY+4,BOARDX-1,"E├┼┼┼┼┼┼┼┼┼┼┼┼┼┤");
mvprintw(BOARDY+5,BOARDX-1,"F├┼┼┼┼┼┼┼┼┼┼┼┼┼┤");
mvprintw(BOARDY+6,BOARDX-1,"G├┼┼┼┼┼┼┼┼┼┼┼┼┼┤");
mvprintw(BOARDY+7,BOARDX-1,"H├┼┼┼┼┼┼┼┼┼┼┼┼┼┤");
mvprintw(BOARDY+8,BOARDX-1,"I├┼┼┼┼┼┼┼┼┼┼┼┼┼┤");
mvprintw(BOARDY+9,BOARDX-1,"J├┼┼┼┼┼┼┼┼┼┼┼┼┼┤");
mvprintw(BOARDY+10,BOARDX-1,"K├┼┼┼┼┼┼┼┼┼┼┼┼┼┤");
mvprintw(BOARDY+11,BOARDX-1,"L├┼┼┼┼┼┼┼┼┼┼┼┼┼┤");
mvprintw(BOARDY+12,BOARDX-1,"M├┼┼┼┼┼┼┼┼┼┼┼┼┼┤");
mvprintw(BOARDY+13,BOARDX-1,"N├┼┼┼┼┼┼┼┼┼┼┼┼┼┤");
mvprintw(BOARDY+14,BOARDX-1,"O└┴┴┴┴┴┴┴┴┴┴┴┴┴┘");
mvaddstr(BOARDY+7,BOARDX+14,QI_BLACK);
refresh();
}
StatusBox(){
mvprintw(MSG_Y,MSG_X,"┌────────────────────────────────┐");
mvprintw(MSG_Y+1,MSG_X,"│");
mvprintw(MSG_Y+1,MSG_X+66,"│");
mvprintw(MSG_Y+2,MSG_X,"│");
mvprintw(MSG_Y+2,MSG_X+66,"│");
mvprintw(MSG_Y+3,MSG_X,"│");
mvprintw(MSG_Y+3,MSG_X+66,"│");
mvprintw(MSG_Y+4,MSG_X,"└────────────────────────────────┘");
}
MsgStatus(){
if(status.cCurrentP == P_BLACK)
mvprintw(MSG_Y+1,MSG_X+12,"Y = %-2d X = %-2d 第 %d 手 当前行棋方:%-8s",status.nCursorY - BOARDY,(status.nCursorX - BOARDX) / 2,status.nShou,status.cNameB);
else
mvprintw(MSG_Y+1,MSG_X+12,"Y = %-2d X = %-2d 第 %d 手 当前行棋方:%-8s",status.nCursorY - BOARDY,(status.nCursorX - BOARDX) / 2,status.nShou,status.cNameW);
}
/* 返回按键类型 */
int CheckKey(int nKey){
switch(nKey){
case PLAY_EXIT :
return KEYTYPE_EXIT;
break;
case PLAY1_UP :
case PLAY1_DOWN :
case PLAY1_LEFT :
case PLAY1_RIGHT :
case PLAY2_UP :
case PLAY2_DOWN :
case PLAY2_LEFT :
case PLAY2_RIGHT :
return KEYTYPE_MOVE;
break;
case PLAY1_FALL :
case PLAY2_FALL :
return KEYTYPE_FALL;
break;
case PLAY_ABOUT :
case BOSSKEY :
return KEYTYPE_OTHER;
default :
return KEYTYPE_INVALID;
break;
}
}
/* */
DrawSign(){
char drawsign[3];
strcpy(drawsign,CROSS);
if( 0 == status.nCursorY - BOARDY ){
switch(status.nCursorX - BOARDX){
case 0 :
strcpy(drawsign,UL);
break;
case 28 :
strcpy(drawsign,UR);
break;
default :
strcpy(drawsign,US);
}
}
if( 14 == status.nCursorY - BOARDY ){
switch(status.nCursorX - BOARDX){
case 0 :
strcpy(drawsign,BL);
break;
case 28 :
strcpy(drawsign,BR);
break;
default :
strcpy(drawsign,BS);
}
}
if((0 == status.nCursorX - BOARDX) && (status.nCursorY - BOARDY >; 0) && (status.nCursorY - BOARDY < 14))
strcpy(drawsign,LS);
if((28 == status.nCursorX - BOARDX) && (status.nCursorY - BOARDY >; 0) && (status.nCursorY - BOARDY < 14))
strcpy(drawsign,RS);
mvaddstr(status.nCursorY,status.nCursorX,drawsign);
}
CursorMove(int nKey){
switch(nKey){
case PLAY1_UP:
if(((status.nCursorY-BOARDY) >; 0) && (status.cCurrentP == P_BLACK)){
status.nCursorY -= 1;
}
break;
case PLAY1_DOWN:
if(((status.nCursorY-BOARDY) < 14) && (status.cCurrentP == P_BLACK)){
status.nCursorY += 1;
}
break;
case PLAY1_LEFT:
if(((status.nCursorX-BOARDX) >; 0) && (status.cCurrentP == P_BLACK)){
status.nCursorX -= 2;
}
break;
case PLAY1_RIGHT:
if(((status.nCursorX-BOARDX) < 28) && (status.cCurrentP == P_BLACK)){
status.nCursorX += 2;
}
break;
case PLAY2_UP:
if(((status.nCursorY-BOARDY) >; 0) && (status.cCurrentP == P_WHITE)){
status.nCursorY -= 1;
}
break;
case PLAY2_DOWN:
if(((status.nCursorY-BOARDY) < 14) && (status.cCurrentP == P_WHITE)){
status.nCursorY += 1;
}
break;
case PLAY2_LEFT:
if(((status.nCursorX-BOARDX) >; 0) && (status.cCurrentP == P_WHITE)){
status.nCursorX -= 2;
}
break;
case PLAY2_RIGHT:
if(((status.nCursorX-BOARDX) < 28) && (status.cCurrentP == P_WHITE)){
status.nCursorX += 2;
}
break;
}
}
DrawQi(){
switch(cChessBoard[status.nCursorY-BOARDY][(status.nCursorX-BOARDX)/2]){
case P_NULL :
attron(A_BLINK);
if(status.cCurrentP == P_BLACK)
mvaddstr(status.nCursorY,status.nCursorX,QI_BLACK);
if(status.cCurrentP == P_WHITE)
mvaddstr(status.nCursorY,status.nCursorX,QI_WHITE);
attroff(A_BLINK);
break;
case P_WHITE :
attron(A_REVERSE);
mvaddstr(status.nCursorY,status.nCursorX,QI_BLACK);
attroff(A_REVERSE);
break;
case P_BLACK :
attron(A_REVERSE);
mvaddstr(status.nCursorY,status.nCursorX,QI_WHITE);
attroff(A_REVERSE);
break;
}
}
ChangeOrder(){
if(status.cCurrentP == P_BLACK)
status.cCurrentP = P_WHITE;
else
status.cCurrentP = P_BLACK;
}
FallQi(int nkey){
int nRtn=NULL;
if(cChessBoard[status.nCursorY-BOARDY][(status.nCursorX-BOARDX)/2] == P_NULL){
if(( P_BLACK == status.cCurrentP) && ( nkey == PLAY1_FALL)){
mvaddstr(status.nCursorY,status.nCursorX,QI_BLACK);
cChessBoard[(status.nCursorY-BOARDY)][(status.nCursorX-BOARDX)/2] = P_BLACK;
nRtn = TRUE;
}
if(( P_WHITE == status.cCurrentP) && ( nkey == PLAY2_FALL)){
mvaddstr(status.nCursorY,status.nCursorX,QI_WHITE);
cChessBoard[status.nCursorY-BOARDY][(status.nCursorX-BOARDX)/2] = P_WHITE;
nRtn = TRUE;
}
}
return nRtn;
}
int JudgeWin(){
int i;
for(i=0;i<4;i++){
if(TRUE == CheckLine(i))
return TRUE;
}
return FALSE;
}
int CheckLine(int direction){
int i;
STATUS pos,dpos;
const int testnum = 5;
int count;
switch(direction){
case 0 : /* 水平 */
pos.nCursorY = status.nCursorY - BOARDY;
pos.nCursorX = (status.nCursorX - BOARDX)/2 - (testnum - 1);
dpos.nCursorY = 0;
dpos.nCursorX = 1;
break;
case 1 : /* 垂直 */
pos.nCursorY = status.nCursorY - BOARDY - (testnum - 1);
pos.nCursorX = (status.nCursorX - BOARDX)/2;
dpos.nCursorY = 1;
dpos.nCursorX = 0;
break;
case 2 : /* 左上--右下 */
pos.nCursorY = status.nCursorY - BOARDY - (testnum - 1);
pos.nCursorX = (status.nCursorX - BOARDX)/2 - (testnum - 1);
dpos.nCursorY = 1;
dpos.nCursorX = 1;
break;
case 3 : /* 左下--右上 */
pos.nCursorY = status.nCursorY - BOARDY + (testnum - 1);
pos.nCursorX = (status.nCursorX - BOARDX)/2 - (testnum - 1);
dpos.nCursorY = -1;
dpos.nCursorX = 1;
break;
}
count = 0;
for(i=0;i if(pos.nCursorX>;=0&&pos.nCursorX<=14&&pos.nCursorY>;=0&&pos.nCursorY<=14){
if(cChessBoard[pos.nCursorY][pos.nCursorX] == status.cCurrentP){
count++;
if(count >;= testnum)
return TRUE;
}
else count = 0;
}
pos.nCursorY += dpos.nCursorY;
pos.nCursorX += dpos.nCursorX;
}
return FALSE;
}
DoWin(int *flag,int *ju){
int nKey;
*flag = 1;
srand(snd);
snd = (rand() % 4) + 1;
if(P_BLACK == status.cCurrentP){
mvprintw(MSG_Y + 2,MSG_X+2,"%-8s : ",status.cNameB);
mvprintw(MSG_Y + 3,MSG_X+2,"%-8s : ",status.cNameW);
}
else{
mvprintw(MSG_Y + 2,MSG_X+2,"%-8s : ",status.cNameW);
mvprintw(MSG_Y + 3,MSG_X+2,"%-8s : ",status.cNameB);
}
if( P_BLACK == status.cCurrentP && 0 == strcmp(status.cNameB," Jacks "))
snd = 0;
if( P_WHITE == status.cCurrentP && 0 == strcmp(status.cNameW," Jacks "))
snd = 0;
attron(A_BLINK);
mvprintw(MSG_Y + 2,MSG_X + 14,"%s",cWordWiner[snd]);
mvprintw(MSG_Y + 3,MSG_X + 14,"%s",cWordLoster[snd]);
attroff(A_BLINK);
mvprintw(BOARDY + 2, BOARDX + 6,"再来一局吗?(Y/N)");
do{
nKey = getch();
if(nKey == 'Y' || nKey == 'y'){
*ju = 1;
*flag = 0;
}
}while(nKey != 'Y' && nKey != 'y' && nKey != 'N' && nKey != 'n');
}
OtherDeal(int nKey){
switch(nKey){
case PLAY_ABOUT :
MsgAbout();
break;
case BOSSKEY :
MsgBoss();
break;
}
}
MsgAbout(int y, int x){
mvprintw(y+0,x,"┌────────┐");
mvprintw(y+1,x,"│没有净手 │");
mvprintw(y+2,x,"│ 就是下棋 │");
mvprintw(y+3,x,"│ │");
mvprintw(y+4,x,"│ │");
mvprintw(y+5,x,"│ │");
mvprintw(y+6,x,"│ │");
mvprintw(y+7,x,"└────────┘");
refresh();
getch();
}
MsgBoss(){
int i,ch;
WINDOW *winboss;
touchwin(stdscr);
winboss = newwin(24,80,0,0);
// werase(winboss);
mvwprintw(winboss,0,30,"近期工作小结");
mvwprintw(winboss,2,1,"1 : 领导很有指挥才能和领导能力,从他那里学到了不少东西,受益匪浅!");
mvwprintw(winboss,4,1,"2 : 深深地感受到自己还有很多不足,需要学习的东西很多,今后要加倍的工作和努力学习!");
mvwprintw(winboss,6,1,"3 : 下一阶段的目标和任务是:");
// wrefresh(winboss);
for(i=0;;){
ch = wgetch(winboss);
if( '*' == ch)
break;
mvwaddch(winboss,6,28+i,ch);
i++;
wrefresh(winboss);
}
refresh();
}
CopyRight(int y, int x){
clear();
mvprintw(y+0,x,"------------------");
mvprintw(y+1,x," RIF1.0c ");
mvprintw(y+2,x," ");
mvprintw(y+3,x," Written By ");
mvprintw(y+4,x," WoodBo ");
mvprintw(y+5,x," Jul 2002 ");
mvprintw(y+6,x," ");
attron(A_BOLD);
mvprintw(y+7,x," ");
attroff(A_BOLD);
mvprintw(y+8,x,"------------------");
getch();
}