最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
迷宫探路II
时间:2008-04-26 编辑:简简单单 来源:一聚教程网
对《迷宫探路》做了一点改进。小人在行走过程中不走回头路,
即不重复经过同一点。
/* crazymaze.c*/
/* 2003-8-26 */
#include
#include
#include
#include
#include
#define N 22
#define M 22
#define MAXLEN 200;
int bg[M][N];
struct square{
int x;
int y;
int direc;
}p[200];
void makebg(int,int);
void drawbg(int[][],int,int,int,int,int);
void drawman(int,int,int);
void rect(int,int,int,int);
void main(){/* main()开始 */
int step=20;
int len=10;
int size=20;
int x=0,y=0,x0=0,y0=0;
int i=0,j=0,k=0,count=0;
int gdriver=DETECT,gmode;
char ch;
int direc;
makebg(M,N);
/* registerbgidriver(EGAVGA_driver);
initgraph(&gdriver,&gmode,"c:\turboc2");*/
initgraph(&gdriver,&gmode,"c:\tc20\bgi");
cleardevice();
setwritemode(XOR_PUT);
settextstyle(1,0,3);
setcolor(GREEN);
outtextxy(100,180,"Press to quit");
setcolor(BLUE);
setfillstyle(LINE_FILL,BLUE);
drawbg(bg,M,N,size,0,0);
setcolor(GREEN);
outtextxy(60,120,"PRESS KEY <1> :YOU ,");
outtextxy(70,150,"OTHER KEY :AUTOMATIC");
setcolor(WHITE);
x+=len;y+=len;
drawman(x,y,len);
x0=x;y0=y;
if((ch=getch())=='1'){
/* 人工控制 */
while((ch=getch())!='q'){
delay(800);
drawman(x,y,len);
switch(ch){
case 'a':
if(j>0&&bg[i][j-1]==0){
if(x>step){x-=step;j--;};
}
break;
case 's':
if(i
}
break;
 
-
上一个: 我的马踏棋盘
-
下一个: 数据结构演示(tc版)
相关文章
- C#复制数组的两种方式及效率比较解读 10-24
- ASP.NET Identity用法解析 10-24
- ASP.NET MVC使用Identity增删改查用户介绍 10-24
- C语言中atoi函数模拟实现介绍 10-18
- .Net反向代理组件Yarp用法介绍 10-10
- .NET使用YARP通过编码方式配置域名转发实现反向代理教程 10-10