五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

給你們個(gè)c語(yǔ)言源代碼不用謝

2023-07-29 20:07 作者:曲曲蛐蛐兒  | 我要投稿

#include <stdio.h>

int main ()

{

int screen[9][11]={

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

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

????{0,1,0,2,2,2,2,2,0,1,0},

????{0,1,0,2,0,2,0,2,0,1,1},

????{0,1,0,0,0,3,0,0,2,0,1},

????{1,1,0,1,1,1,1,0,2,0,1},

????{1,0,4,4,4,4,4,1,0,0,1},

????{1,0,4,4,4,4,4,0,0,1,1},

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

};//定義為全局變量 (地圖) i表示行,j表示列


int cum(){

????int i,j,k=0;

????for(i=0;i<9;i++){

????????for(j=0;j<11;j++){

????????????if(screen[i][j]==2){

????????????????k++;

????????????}

????????}

????}//遍歷整個(gè)二維數(shù)組

????return k;

}//計(jì)算地圖中有多少個(gè)終點(diǎn)

\

void print(){

????int i,j;

????printf("請(qǐng)用wsad代表上下左右來(lái)進(jìn)行游戲\n");

????for(i=0;i<9;i++){

????????for(j=0;j<11;j++){

????????????switch(screen[i][j]){

????????????????case 0:

????????????????????printf(" ?");//空

????????????????????break;

????????????????case 1:

????????????????????printf("■");//墻

????????????????????break;

????????????????case 2:

????????????????????printf("★");//箱子

????????????????????break;

????????????????case 3:

????????????????????printf("♀");//人

????????????????????break;

????????????????case 4:

????????????????????printf("○");//終點(diǎn)

????????????????????break;

????????????????case 6:

????????????????????printf("★");

????????????????????break;//箱子和終點(diǎn)

????????????????case 7:

????????????????????printf("♀");

????????????????????break;

????????????}

????????}

????????printf("\n");

????}

}


int win(){

????int i,j,k=0;

????int t=0;

????for(i=0;i<9;i++){

????????for(j=0;j<11;j++){

????????????if(screen[i][j]==6){

????????????????k++;

????????????}

????????}

????}//遍歷整個(gè)二維數(shù)組,計(jì)算箱子在終點(diǎn)上的個(gè)數(shù)

????if(k==cum()){

????t=1;

????}//如果個(gè)數(shù)等于前面計(jì)算出的終點(diǎn)個(gè)數(shù),則說(shuō)明所有終點(diǎn)都放了箱子,說(shuō)明游戲勝利

????return t;

} //判斷贏


int lose(){

????int i,j;

????int k=0;

????for(i=0;i<9;i++){

????????for(j=0;j<11;j++){

????????????if(i>0 && j>0 ){????

????????????if(screen[i][j] == 2 || screen[i][j] == 6){

????????????????if(((screen[i-1][j] == 1 || screen[i-1][j] == 2 || screen[i-1][j] == 6) && (screen[i][j-1] == 1 || screen[i][j-1] == 2 || screen[i][j-1] == 6))

????????????????|| ((screen[i][j-1] == 1 || screen[i][j-1] == 2 || screen[i][j-1] == 6) && (screen[i+1][j] == 1 || screen[i+1][j] == 2 || screen[i+1][j] == 6))

????????????????|| ((screen[i+1][j] == 1 || screen[i+1][j] == 2 || screen[i+1][j] == 6) && (screen[i][j+1] == 1 || screen[i][j+1] == 2 || screen[i][j+1] == 6))

????????????????|| ((screen[i][j+1] == 1 || screen[i][j+1] == 2 || screen[i][j+1] == 6) && (screen[i-1][j] == 1 || screen[i-1][j] == 2 || screen[i-1][j] == 6))){

????????????????????k++;

????????????????}

????????????}

????????}

????????}/*這里也是遍歷了整個(gè)數(shù)組,判斷所有的箱子四個(gè)方向的情況,

????????如果有三個(gè)方向被堵住了說(shuō)明箱子無(wú)法移動(dòng)了,也表明這個(gè)箱子失效了,

????????用k來(lái)記錄失效的個(gè)數(shù),當(dāng)全部失效時(shí)游戲失敗

????????(這是游戲的玩法,其實(shí)有一個(gè)被堵住就已經(jīng)不可能勝利了)*/

????}

????if(k==cum()){

????????k=1;

????}

????return k;//返回1說(shuō)明游戲失敗

}


void movew(){

????if(x>0){

????????if(screen[x-1][y]==1){

????????????return ;/*如果箱子的上面是墻,則地圖不會(huì)發(fā)生變化,因?yàn)?/p>

????????????推不動(dòng)嘛*/

????????}else if(screen[x-1][y]==0){

????????????screen[x-1][y]+=3;

????????????screen[x][y]-=3;

????????????x--;/*如果前面是空地,則需要向前移動(dòng)一格,也就是原先人的位置

????????????變成空地,前方的空地變成人,空地(0)變成人(3)需要加3,

????????????人變成空地需要減3*/

????????}else if(screen[x-1][y]==4){

????????????screen[x-1][y]+=3;

????????????screen[x][y]-=3;

????????????x--;

????????}//一樣的

????????else if(screen[x-1][y]==2||screen[x-1][y]==6){

????????????????if(screen[x-2][y]==0){

????????????????????screen[x-2][y]+=2;//箱子前面的格變成箱子(2)

????????????????????screen[x-1][y]+=1;//箱子的位置變成人(3)

????????????????????screen[x][y]-=3;/*如果前面是空地,則需要向前移動(dòng)

????????????????????一格,也就是原先是箱子的格子變成人,人的位置變成空

????????????????????地,原先的空地變成箱子,箱子(2)變成人(3)需要減

????????????????????3,空地變成人*/

????????????????????x--;

????????????????}else if(screen[x-2][y]==1){

????????????????????return ;

????????????????}else if(screen[x-2][y]==2){

????????????????return;//如果箱子的前面是墻或者其他的箱子,則箱子推不動(dòng)

????????????????}else if(screen[x-2][y]==4){

????????????????????screen[x-2][y]+=2;

????????????????????screen[x-1][y]+=1;

????????????????????screen[x][y]-=3;

????????????????????x--;

????????????????}//這個(gè)情況別漏了

????????????}

????}

}


void moves(){

????if(x<9){

????????if(screen[x+1][y]==1){

????????????return ;

????????}else if(screen[x+1][y]==0){

????????????screen[x+1][y]+=3;

????????????screen[x][y]-=3;

????????????x++;

????????}else if(screen[x+1][y]==4){

????????????screen [x+1][y]+=3;

????????????screen[x][y]-=3;

????????????x++;

????????}

????????else if(screen[x+1][y]==2||screen[x+1][y]==6){

????????????????if(screen[x+2][y]==1){

????????????????????return;

????????????????}else if(screen[x+2][y]==0){

????????????????????screen[x+2][y]+=2;

????????????????????screen[x+1][y]+=1;

????????????????????screen[x][y]-=3;

????????????????????x++;

????????????????}else if(screen[x+2][y]==2){

????????????????????return ;

????????????????}else if(screen[x+2][y]==4){

????????????????????screen[x+2][y]+=2;

????????????????????screen[x+1][y]+=1;

????????????????????screen[x][y]-=3;

????????????????????x++;

????????????????????}

????????????????}

????????????}

}


void movea(){

????if(y>0){

????if(screen[x][y-1]==1){

????????return;

????}else if(screen[x][y-1]==4){

????????screen[x][y-1]+=3;

????????screen[x][y]-=3;

????????y--;

????}

????else if(screen[x][y-1]==0){

????????screen[x][y-1]+=3;

????????screen[x][y]-=3;

????????y--;

????}else if(screen[x][y-1]==2||screen[x][y-1]==6){

????????????if(screen[x][y-2]==0){

????????????????screen[x][y-2]+=2;

????????????????screen[x][y-1]+=1;

????????????????screen[x][y]-=3;

????????????????y--;

????????????}else if(screen[x][y-2]==1){

????????????????return;

????????????}else if(screen[x][y-2]==2){

????????????????return;

????????????}else if(screen[x][y-2]=4){

????????????????screen[x][y-2]+=2;

????????????????screen[x][y-1]+=1;

????????????????screen[x][y]-=3;

????????????????y--;

????????????}

????????}

}

}

void moved(){

????if(y<9){

????????if(screen[x][y+1]==1){

????????????return;

????????}else if(screen[x][y+1]==4){

????????????screen[x][y+1]+=3;

????????????screen[x][y]-=3;

????????????y++;

????????}

????????else if(screen[x][y+1]==0){

????????????screen[x][y+1]+=3;

????????????screen[x][y]-=3;

????????????y++;

????????}else

????????????if(screen[x][y+1]==2||screen[x][y+1]==6){

????????????????if(screen[x][y+2]==0){

????????????????????screen[x][y+2]+=2;

????????????????????screen[x][y+1]+=1;

????????????????????screen[x][y]-=3;

????????????????????y++;

????????????????}else if(screen[x][y+2]==4){

????????????????????screen[x][y+2]+=2;

????????????????????screen[x][y+1]+=1;

????????????????????screen[x][y]-=3;

????????????????????y++;

????????????????}else if(screen[x][y+2]==2){

????????????????????return;

????????????????}else if(screen[x][y+2]==1){

????????????????????return;

????????????????}

????????????}

????????

????}

}

int main(){

????int n,t;

????int j,k;

????int b=1;

????here:

????????system("cls");//

????printf("開(kāi)始游戲請(qǐng)按1\n退出游戲請(qǐng)按2\n");

????scanf("%d",&j);

????if(j==1){

????printf("請(qǐng)用wsad代表上下左右來(lái)進(jìn)行游戲\n");//這個(gè)就引導(dǎo)進(jìn)入游戲

????while(1){

????????system("cls");/*在每一次移動(dòng)過(guò)后都清除上一個(gè)地圖,不然就會(huì)每走

????????一步生成一個(gè)圖*/

????????print();//先打印地圖

????????scanf("%c",&n);//讀入用戶的操作

????????switch(n){

????????????case 'w':

????????????????movew();

????????????????break;

????????????case 's':

????????????????moves();

????????????????break;

????????????case 'a':

????????????????movea();

????????????????break;

????????????case 'd':

????????????????moved();

????????????????break;

????????} //控制人移動(dòng)

????????t=win();

????????if(t==1){

????????goto there;

????}//每次操作完先判斷游戲是否勝利,如果勝利了直接跳到函數(shù)最后

????if(b == lose()){

????????system("cls");

????????print();

????????printf("游戲失敗");

????????return 0;

????} //游戲失敗提示

}

}else {

????system("cls");

????printf("您確認(rèn)要退出游戲嗎\n確認(rèn)退出按1\t返回上一層按2\n");

????scanf("%d",&k);

????????if(k==1){

????????????printf("你已退出游戲,期待你的再次到來(lái),謝謝");

????????????return 0;

????????}else {

????????????goto here;

????????}

}//這一塊是最前面用戶進(jìn)入游戲那里的,如果用戶選擇退出游戲執(zhí)行的操作

????there:

????????printf("恭喜你通過(guò)了游戲!");

????return 0;

}//主函數(shù)

return 0;

} ?


給你們個(gè)c語(yǔ)言源代碼不用謝的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
桐梓县| 大洼县| 光泽县| 齐河县| 台东县| 甘孜县| 泰州市| 临夏县| 随州市| 丰原市| 尉犁县| 柯坪县| 大安市| 玉田县| 平武县| 巴彦淖尔市| 淮阳县| 马关县| 邛崃市| 正镶白旗| 肇源县| 巴彦淖尔市| 铁岭市| 柏乡县| 三河市| 永宁县| 报价| 阳原县| 塘沽区| 濮阳县| 陆河县| 孟连| 盐池县| 河间市| 德格县| 永城市| 察雅县| 晋州市| 祁东县| 毕节市| 固阳县|