溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

【C語言】迷宮游戲設計思路與功能體會及簡單的改進報告

發(fā)布時間:2020-07-09 21:39:50 來源:網(wǎng)絡 閱讀:2567 作者:KISS_GOD 欄目:編程語言

迷宮游戲設計思路與功能體會及改進報告

學號:150809333


一、         內(nèi)容:

1、 本游戲主要實現(xiàn)了人控制鍵盤方向鍵使小人(*)走出迷宮。

2、 具有的功能:

  1)、在游戲菜單里人可以選擇不同難度的游戲進行游戲;

  2)、在游戲過程中,可以通過鍵盤方向鍵使小人移動,走出迷宮;

  3)、在游戲過程中,當人碰到墻壁(#)的時候小人過不去;

  4)、當人順利完成游戲之后,輸出“========you arewin!======”字樣,30秒鐘后自動返回

       到游戲菜單;

  5)、在游戲過程中,人可以通過按Esc鍵返回游戲菜單;也可以可以按0直接退出游戲;

  6)、在游戲菜單里,按0鍵可以退出游戲。

      3、具體應用:

         1)、人主要同過鍵盤的1,2,3數(shù)字鍵來選擇游戲難度;

  2)、在游戲中通過Esc鍵來返回菜單;

  3)、同過0鍵退出游戲。

 

 

二、         上機環(huán)境   

操作系統(tǒng):windows10

開發(fā)工具:C-Free


三、         各函數(shù)功能說明

main()                          主函數(shù);

menu()                         游戲菜單;

roadcake()                    消去小人路徑;

introduce()                   游戲介紹;

system(“cls”)                消屏函數(shù);

exit(0)                          退出游戲;

      

drawmg1()                   畫簡單難度迷宮;

drawmg2()                   畫中等難度迷宮;

drawmg3()                   畫困難難度迷宮;

 

control1()                     控制簡單難度游戲;

control2()                     控制中等難度游戲;

control3()                     控制困難難度游戲;

 

四、         算法流程圖

首先定義三個全局數(shù)組mg1[20][20]、mg2[30][30]mg3[30][30]用于畫出迷宮的地圖;1表示墻(#),0表示空地( );

Introduce( )函數(shù)里如果按Enter鍵,則調(diào)用menu()函數(shù),從鍵盤中輸入相應的提示數(shù)字,進入難度不同的游戲;游戲的執(zhí)行在此只初級難度進行描述,其余的難度與其類似;

選了1后調(diào)用system”cls”)進行清屏;drawmg1()函數(shù)進行迷宮的地圖的繪制,for(i=0;i<20;i++)

       {

              printf("\t\t\t");

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

              {

                    

                     ch=mg1[i][j];

                     switch(ch)

                     {

                     case4: printf("*");break;

                     case0: printf(" ");break;

                     case1: printf("#");break;

                     }

                     if(num++%20==0)        /*每行只能輸出20個字符*/

                     printf”\n”;

}

}

之后調(diào)用控制函數(shù)control1()進行控制小人移動路徑,在control1()函數(shù)里用dowhile()語句進行循環(huán),while1)進行死循環(huán),再定義四個整型a,b,m,n即:

 

 

 

 

 

 for(n=0;n<30;n++)

                     for(m=0;m<30;m++)

                            if(mg3[n][m]==4)

                            {

                                   a=n;        /*為后面調(diào)用roadcake()實現(xiàn)消除小人路徑進行初始賦值*/

                                   b=m;break;           

                            }

switch()語句選擇方向鍵,在調(diào)用roadcake()函數(shù)進行消除小人路徑

voidroadcake(int *i,int *j)

{

       int temp;

       temp=*i;               /*進行值交換,即數(shù)組值為0和值為4進行交換

       *i=*j;

       *j=temp;

}

完成第一個控制之后進行清屏和畫新的游戲狀態(tài)圖,若在游戲進行中要退出游戲,只需按0鍵,調(diào)用exit0)函數(shù)結束;若要返回游戲菜單,按Esc鍵掉用menu()函數(shù)即可,重復以上步驟,直達游戲結束,此時掉用menu()函數(shù)自動返回菜單。


五、         總結


本次設計改進作業(yè)使我對于C語言有了更深的理解,不僅重新回顧了上學期所學的基礎內(nèi)容,還有了進一步的感悟,讓我知道了,不管設計多么復雜的程序,“#include<stdio.h>”等基礎內(nèi)容都是必不可少的,int,for循環(huán),printf等更是不可或缺,它們雖然基礎,但是卻為我們建立了一個良好的程序架構,簡單與簡單之間相互組合,循環(huán)之中套著循環(huán),才能組成更為復雜的程序,同樣也才能使得程序的功能更為完善,在這里由衷的感謝王成金老師帶領我們走過了這半個學期的學習與生活,接下來就寫出此次程序設計的源代碼以及簡單的改進報告。


六、         程序源代碼


#include<stdio.h>

#include<conio.h>

#include<time.h>

#include<stdlib.h>


void drawmg1(void); /*定義畫迷宮函數(shù)*/

void drawmg2(void);

void drawmg3(void);


void control1(void); /*定義控制函數(shù)*/

void control2(void);

void control3(void);


void roadcake(int *i,int *j); /*定義交換函數(shù)*/


void menu(void); /*定義菜單函數(shù)*/


void introduce(void); /*定義游戲介紹函數(shù)*/


int mg1[20][20]={{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

{1,1,1,1,1,1,1,1,1,1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,1,1,1,0,1},

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

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

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

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

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

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

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

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

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

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

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

};


int road[20][20];



void main()

{

introduce();

}


/*-----------------------------------------------------------------------------*/


/*初級游戲控制函數(shù)*/


void control1(void)

{

int a,b,m,n;

char num;

do /*循環(huán)取得空制鍵*/

{

for(n=0;n<20;n++)

for(m=0;m<20;m++)

if(mg1[n][m]==4)

{

a=n;

b=m;break;

}

num=getch();

switch(num)

{

case 72:if(mg1[a-1][b]!=1)

{

roadcake(&mg1[a][b],&mg1[a-1][b]);

system("cls");

drawmg1();

   break;

}

case 80:if(mg1[a+1][b]!=1)

{

  roadcake(&mg1[a][b],&mg1[a+1][b]);

system("cls");

drawmg1();

 

  break;

}


case 75:if(mg1[a][b-1]!=1) 

{

roadcake(&mg1[a][b],&mg1[a][b-1]);

system("cls");

drawmg1();

 

 break;

}

  

case 77:if(mg1[a][b+1]!=1)

{

roadcake(&mg1[a][b],&mg1[a][b+1]);

system("cls");

drawmg1();

  break;

}

case 27:system("cls");

menu();break;


case 48:exit(0);


}

if(mg1[18][19]==4)

{printf("\n\t------------------you are win!--------------------\n\n\n");

menu();

}

}

while(1); /*直到出口*/


}





/*-----------------------------------------------------------------------------*/


/*中級游戲控制函數(shù)*/


void control2(void)

{

int a,b,m,n;

char num;

do /*循環(huán)取得空制鍵*/

{

for(n=0;n<30;n++)

for(m=0;m<30;m++)

if(mg2[n][m]==4)

{

a=n;

b=m;break;

}


num=getch();

switch(num)

{

case 72:if(mg2[a-1][b]!=1)

{

roadcake(&mg2[a][b],&mg2[a-1][b]);

system("cls");

drawmg2();

   break;

}

case 80:if(mg2[a+1][b]!=1)

{

  roadcake(&mg2[a][b],&mg2[a+1][b]);

system("cls");

drawmg2();

 

  break;

}


case 75:if(mg2[a][b-1]!=1) 

{

roadcake(&mg2[a][b],&mg2[a][b-1]);

system("cls");

drawmg2();

 

 break;

}

  

case 77:if(mg2[a][b+1]!=1)

{

roadcake(&mg2[a][b],&mg2[a][b+1]);

system("cls");

drawmg2();

  break;

}

case 27:system("cls");

menu();break;


case 48:exit(0);


}

if(mg2[29][15]==4)

{printf("\n\t------------------you are win!--------------------\n\n\n");

menu();

}

}

while(1); /*直到出口*/


}






/*-----------------------------------------------------------------------------*/


/*高級游戲控制函數(shù)*/


void control3(void)

{

int a,b,m,n;

char num;

do /*循環(huán)取得空制鍵*/

{

for(n=0;n<30;n++)

for(m=0;m<30;m++)

if(mg3[n][m]==4)

{

a=n;

b=m;break;

}


num=getch();

switch(num)

{

case 72:if(mg3[a-1][b]!=1)

{

roadcake(&mg3[a][b],&mg3[a-1][b]);

system("cls");

drawmg3();

   break;

}

case 80:if(mg3[a+1][b]!=1)

{

  roadcake(&mg3[a][b],&mg3[a+1][b]);

system("cls");

drawmg3();

 

  break;

}


case 75:if(mg3[a][b-1]!=1) 

{

roadcake(&mg3[a][b],&mg3[a][b-1]);

system("cls");

drawmg3();

 

 break;

}

  

case 77:if(mg3[a][b+1]!=1)

{

roadcake(&mg3[a][b],&mg3[a][b+1]);

system("cls");

drawmg3();

  break;

}


case 27:system("cls");

menu();break;


case 48:exit(0);



}

if(mg3[0][15]==4)

{printf("\n\t------------------you are win!--------------------\n\n\n");

menu();

}


}

while(1); /*直到出口*/


}





/*--------------------------------------------------------------------------------*/


/*畫簡單謎宮函數(shù)*/

void drawmg1(void)

{

int i,j,ch,num=1;

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

{

printf("\t\t\t");

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

{

ch=mg1[i][j];

switch(ch)

{

case 4: printf("*");break;

case 0: printf(" ");break;

case 1: printf("#");break;

}

if(num++%20==0)

printf("\n");

}

}

}



/*--------------------------------------------------------------------------------*/


/*畫中等謎宮函數(shù)*/

void drawmg2(void)

{

int i,j,ch,num=1;

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

{

printf("\t\t\t");

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

{

ch=mg2[i][j];

switch(ch)

{

case 4: printf("*");break;

case 0: printf(" ");break;

case 1: printf("#");break;

}

if(num++%30==0)

printf("\n");

}

}

}




/*--------------------------------------------------------------------------------*/


/*畫困難謎宮函數(shù)*/

void drawmg3(void)

{

int i,j,ch,num=1;

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

{

printf("\t\t\t");

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

{

ch=mg3[i][j];

switch(ch)

{

case 4: printf("*");break;

case 0: printf(" ");break;

case 1: printf("#");break;

}

if(num++%30==0)

printf("\n");

}

}

}






/*---------------------------------------------------------------------------*/

/*交換函數(shù)*/


void roadcake(int *i,int *j)

{

int temp;

temp=*i;

*i=*j;

*j=temp;

}



/*---------------------------------------------------------------------------*/

/*游戲介紹函數(shù)*/


void introduce(void)

{ char ch;

printf("\t>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>welcome<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");

printf("\t這是一個迷宮小游戲,你可以選擇不同的難度進行游戲\n\n");

printf("\t具體游戲操作如下:\n\n");

printf("\t\t通過鍵盤方向↑ → ← ↓來控制小人(*)上、右、左、下移動;\n");

printf("\t\t在游戲過程中可以按Esc鍵返回菜單欄,按0鍵結束游戲!\n\n");

printf("\t\t\t\t\t\t\t請按Enter鍵進入游戲\n");

ch=getch();

if(ch==13)

system("cls");

menu();

}




/*----------------------------------------------------------------------------*/


/*游戲菜單函數(shù)*/


void menu(void)

{

char ch;


printf("\n\n\n請選擇游戲難度:");

printf("\t\t【1:簡單】\n\n");

printf("\t\t\t【2:中等】\n\n");

printf("\t\t\t【3:困難】\n\n");

printf("\t\t\t【0:退出】\n\n");

scanf("%d",&ch);

switch(ch)

{

case 1:system("cls");

drawmg1();

/*簡單游戲*/

control1();

break;

case 2:system("cls");

drawmg2(); /*中等游戲*/

control2();break;


case 3:system("cls");

drawmg3(); /*困難游戲*/

control3();break;

case 0:exit(0);

}

}


/*------------------------------------------------------------------------------*/


七、         程序簡單改進報告


我們可以對程序進行一些簡單的改進,例如在開始界面或選擇難度的頁面中添加一些歡迎語言,或者對迷宮本身進行難度上的調(diào)整,首先,我們對迷宮的歡迎界面設置一個簡單的歡迎語:

在源程序中的

“printf("\t>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>welcome<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");”

printf("\t這是一個迷宮小游戲,你可以選擇不同的難度進行游戲\n\n");”

之間添加一行代碼:

“printf("\t歡迎使用由【計科2班-張翼國】設計的迷宮游戲,您可以自行與同伴進行限時比賽^-^\n\n");”

上面便是對程序界面進行的簡單改進,通過這種改進,我們可以完善自己對使用者進行的程序介紹,以及添加一些廣告信息等等,也可以通過修改使程序界面更加好看,總之妙用無窮。


接下來,我們還可以對程序的核心內(nèi)容——迷宮本身,進行一些修改,例如:


將簡單迷宮的倒數(shù)第三行:“{1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1},

修改為: {1,0,0,0,1,0,0,0,0,1,0,0,1,1,0,0,1,1,1,1},

類似的修改不僅可以對迷宮的BUG進行修復,還可以根據(jù)使用者的建議對迷宮本身的難度進行一定的調(diào)整。

當然了,C語言是非常奇妙的,還有其他各種各樣的修改方式,這就需要開動我們的大腦去思考與設計了,修改程序不僅可以使我們對C語言的代碼更加熟悉,更可以強化我們的邏輯思維,就如同“天下作文一大抄”這句俗語一樣,我們的C語言一樣可以汲取別人的精華之處,并對一些糟粕之處予以改進。


以上便是我對本次程序設作業(yè)的功能體會與簡單的改進報告了,通過此次作業(yè),我確實受益匪淺,查找資料的過程更是從網(wǎng)上的一些小程序代碼之中學到了很多,再一次感謝王成金老師的指導與陪伴。




向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。

AI