中国象棋源代码-C语言小程序

合集下载
相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

*--------------------chess.c----------------------*/ #include "dos.h"

#include "stdio.h"

/*----------------------------------------------------*/ #define RED 7

#define BLACK 14

#define true 1

#define false 0

#define SELECT 0

#define MOVE 1

#define RED_UP 0x1100

#define RED_DOWN 0x1f00

#define RED_LEFT 0x1e00

#define RED_RIGHT 0x2000

#define RED_DO 0x3900

#define RED_UNDO 0x1000

#define BLACK_UP 0x4800

#define BLACK_DOWN 0x5000

#define BLACK_LEFT 0x4b00

#define BLACK_RIGHT 0x4d00

#define BLACK_DO 0x1c00

#define BLACK_UNDO 0x2b00

#define ESCAPE 0x0100

#define RED_JU 1

#define RED_MA 2

#define RED_XIANG 3

#define RED_SHI 4

#define RED_JIANG 5

#define RED_PAO 6

#define RED_BIN 7

#define BLACK_JU 8

#define BLACK_MA 9

#define BLACK_XIANG 10

#define BLACK_SHI 11

#define BLACK_JIANG 12

#define BLACK_PAO 13

#define BLACK_BIN 14

/*----------------------------------------------------*/ int firsttime=1;

int savemode;

char page_new=0,page_old=0;

int finish=false,turn=BLACK,winner=0;

int key;

int redstate=SELECT,blackstate=SELECT;

int board[10][9];

/*----------------------------------------------------*/

char *chessfile[15]={"",

"bmp\\rju.wfb", "bmp\\rma.wfb", "bmp\\rxiang.wfb","bmp\\rshi.wfb",

"bmp\\rjiang.wfb","bmp\\rpao.wfb","bmp\\rbin.wfb",

"bmp\\bju.wfb", "bmp\\bma.wfb", "bmp\\bxiang.wfb","bmp\\bshi.wfb",

"bmp\\bjiang.wfb","bmp\\bpao.wfb","bmp\\bbin.wfb"

};

char *boardfile[10][9]={

{"bmp\\11.wfb","bmp\\1t.wfb","bmp\\1t.wfb","bmp\\14.wfb","bmp\\15.wfb","bmp\\16.wfb"," bmp\\1t.wfb","bmp\\1t.wfb","bmp\\19.wfb"},

{"bmp\\21.wfb","bmp\\2c.wfb","bmp\\2c.wfb","bmp\\24.wfb","bmp\\25.wfb","bmp\\26.wfb"," bmp\\2c.wfb","bmp\\2c.wfb","bmp\\29.wfb"},

{"bmp\\21.wfb","bmp\\3a.wfb","bmp\\3t.wfb","bmp\\34.wfb","bmp\\3t.wfb","bmp\\36.wfb"," bmp\\3t.wfb","bmp\\3a.wfb","bmp\\29.wfb"},

{"bmp\\41.wfb","bmp\\4t.wfb","bmp\\4a.wfb","bmp\\4t.wfb","bmp\\4a.wfb","bmp\\4t.wfb","b mp\\4a.wfb","bmp\\4t.wfb","bmp\\49.wfb"},

{"bmp\\51.wfb","bmp\\52.wfb","bmp\\5t.wfb","bmp\\54.wfb","bmp\\5t.wfb","bmp\\56.wfb"," bmp\\5t.wfb","bmp\\58.wfb","bmp\\59.wfb"},

{"bmp\\61.wfb","bmp\\62.wfb","bmp\\6t.wfb","bmp\\64.wfb","bmp\\6t.wfb","bmp\\66.wfb"," bmp\\6t.wfb","bmp\\68.wfb","bmp\\69.wfb"},

{"bmp\\71.wfb","bmp\\7t.wfb","bmp\\7a.wfb","bmp\\7t.wfb","bmp\\7a.wfb","bmp\\7t.wfb","b mp\\7a.wfb","bmp\\7t.wfb","bmp\\79.wfb"},

{"bmp\\81.wfb","bmp\\8a.wfb","bmp\\8t.wfb","bmp\\84.wfb","bmp\\85.wfb","bmp\\86.wfb"," bmp\\8t.wfb","bmp\\8a.wfb","bmp\\89.wfb"},

{"bmp\\91.wfb","bmp\\9t.wfb","bmp\\9t.wfb","bmp\\9t.wfb","bmp\\95.wfb","bmp\\9t.wfb","b mp\\9t.wfb","bmp\\9t.wfb","bmp\\99.wfb"},

{"bmp\\101.wfb","bmp\\102.wfb","bmp\\102.wfb","bmp\\104.wfb","bmp\\105.wfb","bmp\\10 6.wfb","bmp\\108.wfb","bmp\\108.wfb","bmp\\109.wfb"}

};

char cursor[14][14]={

0,0,0,0,0,0,0,0,0,0,0,0,1,1,

0,0,0,0,0,0,0,0,0,0,0,1,1,1,

0,255,255,255,255,255,255,255,0,0,1,1,1,1,

0,255,255,255,255,255,255,0,0,1,1,1,1,1,

0,255,255,255,255,255,255,0,0,1,1,1,1,1,

0,255,255,255,255,255,255,255,0,0,1,1,1,1,

0,255,255,255,255,255,255,255,255,0,0,1,1,1,

0,255,255,255,255,255,255,255,255,255,0,0,1,1,

相关文档
最新文档