美文网首页
无标题文章

无标题文章

作者: 宋涛1120 | 来源:发表于2017-12-16 00:47 被阅读0次

上午学习了示波器等等一些列检测的东西,下午焊板子,帮大家焊板子挺有意思的,毕竟我焊完了整个大家半个都没焊完。只是因为我经常焊而已。

写了半天还差一点,推箱子程序,可以自己发挥想象力改一下,拿走不谢。晚安。

#include#include#includevoid Drawmap();

void PlayGame();

//void GameInit();

//IMAGE box,darkbox,people,end,wall,blank;

int map[8][8]={

{0,0,1,1,1,1,0,0},

{0,1,1,0,0,1,1,0},

{1,1,0,0,0,0,1,0},

{1,0,3,0,3,4,1,1},

{1,0,0,4,5,0,0,1},

{1,1,1,1,7,1,0,1},

{0,0,0,1,0,0,0,1},

{0,0,0,1,1,1,1,1}

};

int main()

{

while(1)

{

system("cls");

Drawmap();

PlayGame();

}

return 0;

}

/*

void GameInit()

{

inttgraph(400,400);

mciSendString(TEXT("open./image/你还要我怎样.mp3 alias music"),0,0,0);

mciSendString(l"play music",0,0,0);

loadimage(&box,TEXT("./image/box"),50,50);

}

*/

void Drawmap()

{

int i,j;

for (i=0;i<8;i++)

{

for (j=0;j<8;j++)

{

switch(map[i][j])

{

case 0:

printf(" ");

break;

case 1:

printf("□");

break;

case 3:

printf("☆");

break;

case 4:

printf("■");

break;

case 5:

printf("♀");

break;

case 7:

printf("★");

break;

case 8:

printf("♂");

break;

}

}

printf("\n");

}

}

void PlayGame()

{

char ch =getch();

/*getchar();//显示回文 按下回车之后接受完毕*/

int r,c,i,j;

for (i=0;i<8;i++)

{

for(j=0;j<8;j++)

r=i;

c=j;

}

/* getch();//注意头文件  两个都是接收字符  不显示回文  直接接收 不需要回车*/

switch(ch)

{

case '72'://shang

if(map[r-1][c]==0||map[r-1][c]==3)

{

map[r-1][c]+=5;//在人前面的位置+5

map[r][c]-=5; //人原来位置-5

}

else if(map[r-1][c]==4||map[r-1][c]==7)

{

if(map[r-2][c]==0||map[r-2][c]==3)

{

map[r-2][c] +=4;

map[r-1][c] +=1;

map[r][c] -=5;

}

}

break;

case '80'://xia

if(map[r+1][c]==0||map[r+1][c]==3)

{

map[r+1][c]+=5;//在人前面的位置+5

map[r][c]-=5; //人原来位置-5

}

else if(map[r+1][c]==4||map[r+1][c]==7)

{

if(map[r+2][c]==0||map[r+2][c]==3)

{

map[r+2][c] +=4;

map[r+1][c] +=1;

map[r][c] -=5;

}

}

break;

case '75'://zuo

if(map[r][c-1]==0||map[r][c-1]==3)

{

map[r][c-1]+=5;//在人前面的位置+5

map[r][c]-=5; //人原来位置-5

}

else if(map[r][c-1]==4||map[r][c-1]==7)

{

if(map[r][c-2]==0||map[r][c-2]==3)

{

map[r][c-2] +=4;

map[r][c-1] +=1;

map[r][c] -=5;

}

}

break;

case '77':

if(map[r][c+1]==0||map[r][c+1]==3)

{

map[r][c+1]+=5;//在人前面的位置+5

map[r][c]-=5; //人原来位置-5

}

else if(map[r][c+1]==4||map[r][c+1]==7)//zuo

{

if(map[r][c+2]==0||map[r][c+2]==3)

{

map[r][c+2] +=4;

map[r][c+1] +=1;

map[r][c] -=5;

}

}

break;

}

}

相关文章

  • 无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章 无标题文章无标题文章无标题文章无...

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标...

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标...

  • fasfsdfdf

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标...

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标...

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标...

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标...

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章

  • 无标题文章

    无标题文章 无标题文章 无标题文章无标题文章 无标题文章 无标题文章

网友评论

      本文标题:无标题文章

      本文链接:https://www.haomeiwen.com/subject/krvjwxtx.html