


下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、#include<stdio.h>#include<stdlib.h>int i,j,steps = 0,gk = 1;char command,t,m = 0,n = 0;int map_1811,map811 = 0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,0,0,0,1,0,0,6,0,0,4,1,0,0,0,1,3,0,2,0,0,4,1,0,0,0,1,0,0,1,1,1,1,1,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;int
2、 map_2811 = 0,0,0,1,1,1,1,0,0,0,0,0,0,0,1,4,0,1,0,0,0,0,1,1,1,1,0,0,1,1,0,0,0,1,0,0,0,3,2,0,1,0,0,0,1,0,1,1,0,0,0,1,0,0,0,1,0,6,0,0,0,0,1,1,0,0,1,1,1,1,0,0,0,4,1,0,0,0,0,0,1,1,1,1,1,1,0,0;int map_3811 = 0,0,0,1,1,1,1,0,0,0,0,0,0,0,1,4,4,1,0,0,0,0,1,1,1,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0
3、,0,0,1,1,0,0,1,1,1,0,1,6,2,0,1,0,0,0,0,1,0,0,3,0,0,1,0,0,0,0,1,1,1,1,1,1,1,0,0;typedef struct positionint x;int y;location;location agg3;/ 全部通过void clearance()if(mapagg1.xagg1.y = 5&&mapagg2.x + nagg2.y + m = 5&&gk =printf(" 你赢了! n"); system("pause");exit(0); / 判断
4、是否通过void control_adopt() if(mapagg1.xagg1.y = 5&&mapagg2.x + nagg2.y + m = 5) if(gk != 3)for(i = 0;i < 8;i+)for(j = 0;j < 11;j+)mapij = map_2ij; map_2ij = map_3ij; map_1ij = mapij;gk+;steps = 0;/ 重新开始void control_reset(char reset_1) if(reset_1 = 'f') for(i = 0;i < 8;i+)for(j
5、 = 0;j < 11;j+) mapij = map_1ij;steps = 0; / 结束void control_end(char end_0) if(end_0 = 't')exit(0);/ 控制方向 + 箱子堵住陷阱void control_direction(char direction_)= 's')if(direction_ = 'd'|direction_= 'w'|direction_= 'a'|direction_if(direction_ = 'd')m = 1;if
6、(direction_ = 'a')m = -1;if(direction_ = 'w')n = -1; if(direction_ = 's')n = 1;if(agg0.x + n = agg1.x&&(agg0.y + m) = agg1.y&&mapagg1.x + nagg1.y + m != 1&&mapagg1.xagg1.y != 5)if(mapagg1.x + nagg1.y + m = 4)mapagg1.xagg1.y = 0; mapagg1.x + nagg1.y + m
7、 = 5; agg1.y = agg1.y + m; agg1.x = agg1.x + n;elset = mapagg1.x + nagg1.y + m;mapagg1.x + nagg1.y + m = mapagg1.xagg1.y; mapagg1.xagg1.y = t;agg1.y = agg1.y + m; agg1.x = agg1.x + n;/ 第二个箱子的判断条件if(agg0.x + n = agg2.x&&(agg0.y + m) = agg2.y&&mapagg2.x + nagg2.y + m != 1&&mapa
8、gg2.xagg2.y != 5)if(mapagg2.x + nagg2.y + m = 4) mapagg2.xagg2.y = 0; mapagg2.x + nagg2.y + m = 5; agg2.y = agg2.y + m; agg2.x = agg2.x + n;elset = mapagg2.x + nagg2.y + m;mapagg2.x + nagg2.y + m = mapagg2.xagg2.y; mapagg2.xagg2.y = t;agg2.y = agg2.y + m;agg2.x = agg2.x + n; if(mapagg0.x + nagg0.y +
9、 m = 0)t = mapagg0.x + nagg0.y + m;mapagg0.x + nagg0.y + m = mapagg0.xagg0.y; mapagg0.xagg0.y = t;agg0.y = agg0.y + m; agg0.x = agg0.x + n;steps+; m = 0; n = 0;/ 输出 , 寻找 1,2,3 void control_output()printf(" 关卡 %d: n",gk); printf(" 步数: %dn",steps);for(i = 0;i < 8;i+)for(j = 0;j
10、< 11;j+)if(mapij = 1) printf(" ");if(mapij = 0) printf(" ");if(mapij = 2) printf(" ");agg1.x = i; agg1.y = j; if(mapij = 3)prin tf(”O");agg0.x = i; agg0.y = j; if(mapij = 4)printf("");if(mapij = 5) printf("");if(mapij = 6) printf(" "
11、;); agg2.x = i; agg2.y = j;printf("n"); printf("w,a,s,d 控制方向, t 退出游戏, f 重新开始! n");/ 输入指令void input_command()while(1) scanf("%c",&command);if(command = 'w'|command = 'a'|command = 's'|command = 'd'|command = 't'|command = 'f')break;main()for(i = 0;i < 8;i+)for(j = 0;j < 12;j+) map_1ij = mapij; while(1) control_
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 《除数是一位数的除法-口算除法》(教学设计)-2023-2024学年三年级下册数学人教版
- 2024-2025年高中化学 专题2 第2单元 提供能量与营养的食物教学设计 苏教版选修1
- 3《荷花》教学设计2023-2024学年统编版语文三年级下册
- Unit3 Are you Su Hai?(Wrap up)(教学设计)-2024-2025学年译林版(三起)(2024)英语三年级上册
- Unit 6 Rain or Shine Section A 2a-2e教案 2024-2025学年人教版(2024)七年级英语下册
- 1《假期有收获》教学设计-2023-2024学年道德与法治二年级上册统编版
- Module 1 Unit 1 How long is the Great Wall (教学设计)-2023-2024学年外研版(一起)英语六年级上册
- 2016年秋八年级地理上册 3.3 水资源教学设计 (新版)新人教版
- 2023三年级数学下册 四 旋转、平移和轴对称第1节 旋转与平移现象第2课时 旋转与平移现象(二)教学设计 西师大版
- 农产品委托收购协议8篇
- 2025年全民国家安全教育日主题教育课件
- DL∕T 2528-2022 电力储能基本术语
- 《立体裁剪》实训指导书
- 【城设计期末复习题】试题3
- T∕CMES 06001-2021 流动科技馆展品机械结构设计规范
- 幼儿园蚂蚁教学认识蚂蚁蚂蚁分类(课堂PPT)
- C35P10计算书
- 小学数学专题讲座:“小学数学计算能力的培养.ppt“
- 年龄更改申请书
- 佛教开灵奠食科仪
- 自动计算空调水管及冷量管径对应表-office2010以上版本
评论
0/150
提交评论