1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
#include<stdio.h> #include<stdilb.h> #include<graphics.h> #include<bios.h> #include<conio.h>
#define LEFT 0x4b00 #define RIGHT 0x4d00 #define DOWN 0x5000 #define UP 0x4800
#define OFFSET 20 #define OFFSET_x 4 #define OFFSet_y 3 #define N 19
int status [N][N]; int step_x step_y; int key; int flag; void DrawBoard(); void DrawCircle(int x,int y,int color); void Alternation(); void JudgePlayer(); void Done(); int ResultCherk(int x,int y); void WelcomeInfo(); void ShowMessage();
void WelcomeInfo() { char ch; gotoxy(12,4); printf("Welcome you to gobang world!"); gotoxy(12,6); printf("1.you can use the up,down,left and right key to move the chessman"); gotoxy(12,8); printf(" and you can press Space to enter after you move it"); gotoxy(12,10); printf(" you can use Esc to exit the game too"); gotoxy(12,12); printf("Do not move the pieces out of the chessboard!"); gotoxy(12,14); printf("Do you want to contine?"); ch=getchar(); if (ch=="n"||ch=="N") exit(0); }
void DrawBoard() { int x1,x2; int y1,y2; setbkcolor(2); setcolor(1); setlinestyle(DOTTED_LINE,1,1); for(x1=1,y1=1,y2=18;x1<=18;x1++) line((x1+OFFSET_x)*OFFSET,(y1+OFFSET_y)*OFFSET,(x1+OFFSET_x)*OFFSET,(y2+OFFSET_y)*OFFSET) for(x1=1,y1=1,x2=18;y1<=18;y++) line((x1+OFFSET_x)*OFFSET,(y1+OFFSET_y)*OFFSET,(x1+OFFSET_x)*OFFSET,(y2+OFFSET_y)*OFFSET) for(x1=1;x1<=18;x1++) for(y1=1;y1<=18;y1++) setcolor(14); settextstyle(1,0,1); outtextxy((19+OFFSET_x)*OFFSET,(2+)) }
|
近期评论