湖南商学院2(4)

2019-06-05 13:47

}

winer *initStep1() {

int x; int y;

winer *win=NULL;winer *pw; gotoxy(25,2);printf(\

for(x=1,y=5;y<=9;y++) printWall(x+4,y+10); for(y=5,x=2;x<=5;x++) printWall(x+4,y+10); for(y=9,x=2;x<=5;x++) printWall(x+4,y+10); for(y=1,x=3;x<=8;x++) printWall(x+4,y+10); for(x=3,y=3;x<=5;x++) printWall(x+4,y+10); for(x=5,y=8;x<=9;x++) printWall(x+4,y+10); for(x=7,y=4;x<=9;x++)printWall(x+4,y+10); for(x=9,y=5;y<=7;y++) printWall(x+4,y+10); for(x=8,y=2;y<=3;y++)

printWall(x+4,y+10); printWall(5+4,4+10); printWall(5+4,7+10);printWall(3+4,2+10);

printBox(3+4,6+10);printBox(3+4,7+10);printBox(4+4,7+10); printDestination1(4+4,2+10,&win,&pw); printDestination1(5+4,2+10,&win,&pw); printDestination1(6+4,2+10,&win,&pw); printMan(2+4,8+10); return win; }

winer *initStep2() {

int x;int y;

winer *win=NULL; winer *pw; gotoxy(25,2);printf(\

for(x=1,y=4;y<=7;y++) printWall(x+4,y+10); for(x=2,y=2;y<=4;y++) printWall(x+4,y+10); for(x=2,y=7;x<=4;x++) printWall(x+4,y+10); for(x=4,y=1;x<=8;x++) printWall(x+4,y+10); for(x=8,y=2;y<=8;y++) printWall(x+4,y+10); for(x=4,y=8;x<=8;x++) printWall(x+4,y+10); for(x=4,y=6;x<=5;x++) printWall(x+4,y+10); for(x=3,y=2;x<=4;x++) printWall(x+4,y+10); for(x=4,y=4;x<=5;x++) printWall(x+4,y+10);

printWall(6+4,3+10); printBox(3+4,5+10);printBox(6+4,6+10);printBox(7+4,3+10); printDestination1(5+4,7+10,&win,&pw); printDestination1(6+4,7+10,&win,&pw); printDestination1(7+4,7+10,&win,&pw); printMan(2+4,6+10); return win;

第 16 页 共 26 页

}

winer *initStep3() {

int x;int y;

winer *win=NULL;winer *pw; gotoxy(25,2);printf(\

for(x=1,y=2;y<=8;y++) printWall(x+4,y+10); for(x=2,y=2;x<=4;x++)printWall(x+4,y+10); for(x=4,y=1;y<=3;y++)printWall(x+4,y+10); for(x=5,y=1;x<=8;x++) printWall(x+4,y+10); for(x=8,y=2;y<=5;y++) printWall(x+4,y+10); for(x=5,y=5;x<=7;x++)printWall(x+4,y+10); for(x=7,y=6;y<=9;y++) printWall(x+4,y+10); for(x=3,y=9;x<=6;x++) printWall(x+4,y+10); for(x=3,y=6;y<=8;y++) printWall(x+4,y+10); printWall(2+4,8+10); printWall(5+4,7+10);

printBox(6+4,3+10); printBox(4+4,4+10);printBox(5+4,6+10); printDestination1(2+4,5+10,&win,&pw); printDestination1(2+4,6+10,&win,&pw); printDestination1(2+4,7+10,&win,&pw); printMan(2+4,4+10); return win; }

winer *initStep4() {

int x;int y;

winer *win=NULL;winer *pw;

gotoxy(23,2);printf(\

for(x=1,y=1;y<=6;y++) printWall(x+4,y+10); for(x=2,y=7;y<=8;y++) printWall(x+4,y+10); for(x=2,y=1;x<=7;x++) printWall(x+4,y+10); for(x=7,y=2;y<=4;y++) printWall(x+4,y+10); for(x=6,y=4;y<=9;y++) printWall(x+4,y+10); for(x=3,y=9;x<=5;x++) printWall(x+4,y+10);

for(x=3,y=3;y<=4;y++) printWall(x+4,y+10);printWall(3+4,8+10); printBox(3+4,5+10); printBox(4+4,4+10);printBox(4+4,6+10); printBox(5+4,5+10);printBox(5+4,3+10); printDestination1(3+4,7+10,&win,&pw); printDestination1(4+4,7+10,&win,&pw); printDestination1(5+4,7+10,&win,&pw); printDestination1(4+4,8+10,&win,&pw); printDestination1(5+4,8+10,&win,&pw); printMan(2+4,2+10); return win;

第 17 页 共 26 页

}

void moveBoxSpacetoSpace(int x,int y,char a) {

switch(a) {

case 'u':

status[x-1][y]=0;printf(\ case 'd':

status[x+1][y]=0; printf(\ case 'l':

status[x][y-1]=0;printf(\ case 'r':

status[x][y+1]=0;printf(\ default:break; } }

void moveBoxDestoSpace(int x,int y,char a) {

switch(a) {

case 'u':

status[x-1][y]='m';printf(\ case 'd':

status[x+1][y]='m';printf(\ case 'l':

status[x][y-1]='m';printf(\ case 'r':

status[x][y+1]='m';printf(\ default:break; } }

void moveBoxSpacetoDes(int x,int y,char a) {

switch(a) {

case 'u':

status[x-1][y]=0;printf(\ case 'd':

status[x+1][y]=0;printf(\ case 'l':

status[x][y-1]=0;printf(\ case 'r':

status[x][y+1]=0;printf(\ default:break;

第 18 页 共 26 页

} }

void moveBoxDestoDes(int x,int y,char a) {

switch(a) {

case 'u':

status[x-1][y]='m';printf(\ case 'd':

status[x+1][y]='m';printf(\ case 'l':

status[x][y-1]='m';printf(\ case 'r':

status[x][y+1]='m';printf(\ default:break; } }

int judge(int x,int y) {

int i;

switch(status[x][y]) {

case 0: i=1;break; case 'w': i=0;break; case 'b': i=2;break; case 'i': i=4;break; case 'm': i=3;break; default: break; }

return i; }

void move(int x,int y,char a) {

switch(a) {

case 'u':

if(!judge(x-1,y)) {gotoxy(y,x);break;}

else if(judge(x-1,y)==1||judge(x-1,y)==3) {

if(judge(x,y)==3)

{printDestination(x,y);printMan(x-1,y);break;} else

{printf(\

第 19 页 共 26 页

}

else if(judge(x-1,y)==2) {

if(judge(x-2,y)==1) {

moveBoxSpacetoSpace(x,y,'u'); if(judge(x,y)==3)

printDestination(x,y); gotoxy(y,x-1); }

else if(judge(x-2,y)==3) {

moveBoxSpacetoDes(x,y,'u'); if(judge(x,y)==3)

printDestination(x,y); gotoxy(y,x-1); } else

gotoxy(y,x); break; }

else if(judge(x-1,y)==4) {

if(judge(x-2,y)==1) {

moveBoxDestoSpace(x,y,'u'); if(judge(x,y)==3)

printDestination(x,y); gotoxy(y,x-1); }

else if(judge(x-2,y)==3) {

moveBoxDestoDes(x,y,'u'); if(judge(x,y)==3)

printDestination(x,y); gotoxy(y,x-1); } else

gotoxy(y,x); break; }

case 'd':

if(!judge(x+1,y)) {gotoxy(y,x);break;}

第 20 页 共 26 页


湖南商学院2(4).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:论文提纲

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: