C语言知识编写象棋软件源代码.doc





《C语言知识编写象棋软件源代码.doc》由会员分享,可在线阅读,更多相关《C语言知识编写象棋软件源代码.doc(24页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、-+/*-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#def
2、ine 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#d
3、efine 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 board109;/*-*/char *chessfile15=,bmprju.wfb,bmprma
4、.wfb,bmprxiang.wfb,bmprshi.wfb,bmprjiang.wfb,bmprpao.wfb,bmprbin.wfb,bmpbju.wfb,bmpbma.wfb,bmpbxiang.wfb,bmpbshi.wfb,bmpbjiang.wfb,bmpbpao.wfb,bmpbbin.wfb;char *boardfile109= bmp11.wfb,bmp1t.wfb,bmp1t.wfb,bmp14.wfb,bmp15.wfb,bmp16.wfb,bmp1t.wfb,bmp1t.wfb,bmp19.wfb, bmp21.wfb,bmp2c.wfb,bmp2c.wfb,bmp2
5、4.wfb,bmp25.wfb,bmp26.wfb,bmp2c.wfb,bmp2c.wfb,bmp29.wfb, bmp21.wfb,bmp3a.wfb,bmp3t.wfb,bmp34.wfb,bmp3t.wfb,bmp36.wfb,bmp3t.wfb,bmp3a.wfb,bmp29.wfb, bmp41.wfb,bmp4t.wfb,bmp4a.wfb,bmp4t.wfb,bmp4a.wfb,bmp4t.wfb,bmp4a.wfb,bmp4t.wfb,bmp49.wfb, bmp51.wfb,bmp52.wfb,bmp5t.wfb,bmp54.wfb,bmp5t.wfb,bmp56.wfb,b
6、mp5t.wfb,bmp58.wfb,bmp59.wfb, bmp61.wfb,bmp62.wfb,bmp6t.wfb,bmp64.wfb,bmp6t.wfb,bmp66.wfb,bmp6t.wfb,bmp68.wfb,bmp69.wfb, bmp71.wfb,bmp7t.wfb,bmp7a.wfb,bmp7t.wfb,bmp7a.wfb,bmp7t.wfb,bmp7a.wfb,bmp7t.wfb,bmp79.wfb, bmp81.wfb,bmp8a.wfb,bmp8t.wfb,bmp84.wfb,bmp85.wfb,bmp86.wfb,bmp8t.wfb,bmp8a.wfb,bmp89.wf
7、b, bmp91.wfb,bmp9t.wfb,bmp9t.wfb,bmp9t.wfb,bmp95.wfb,bmp9t.wfb,bmp9t.wfb,bmp9t.wfb,bmp99.wfb, bmp101.wfb,bmp102.wfb,bmp102.wfb,bmp104.wfb,bmp105.wfb,bmp106.wfb,bmp108.wfb,bmp108.wfb,bmp109.wfb;char cursor1414=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
8、,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,0,255,255,0,255,255,255,255,255,255,255,0,0,1,0,255,0,1,1,0,255,255,255,255,255,2
9、55,255,0,0,0,1,1,1,1,0,255,255,255,255,255,0,1,0,1,1,1,1,1,1,0,255,255,255,0,1,1,1,1,1,1,1,1,1,1,0,255,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1;struct pos int x; int y;position109,redcurpos,redtemppos,redoldpos,blackcurpos,blacktemppos,blackoldpos;/*-*/selectpage(register char page) /*换页函数*/ union REGS r
10、; r.x.ax=0x4f05; r.x.bx=0; r.x.dx=page; /*选择页面*/ int86(0x10,&r,&r);unsigned char set_SVGA_mode(int vmode) /*设置SVGA屏幕模式*/ union REGS r; r.x.ax=0x4f02; r.x.bx=vmode; int86(0x10,&r,&r); return(r.h.ah);unsigned int get_SVGA_mode() /*获取当前SVGA屏幕模式*/ union REGS r; r.x.ax=0x4f03; int86(0x10,&r,&r); return(r
11、.x.bx);drawbmp(int start_x,int start_y,char filename) char buffer640; int i,j,k,n,r,g,b,width,length; long position; FILE *fp; if(fp=fopen(filename,rb)=NULL) printf(Error! Cant open file!); getch(); return; fseek(fp,28,SEEK_SET); fread(&i,2,1,fp); if(i!=8) /*检查是否为256色位图*/ puts(Error!Cant find bitmap
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 语言 知识 编写 象棋 软件 源代码

限制150内