【正文】
w use good the software be a very important problem, it to people daily of a lot of operation have very big of help, for a technical personnel, usually e in contact with original code, this have to academic association usage C language, although now majority of software of design is pass other high class language and adoption system integration the software edit and translate, their cores still can not get away from usage C language to set up, therefore, simple maze procedure of realization beneficial with provide a good mode of thinking in laterly of the development the item. Keyword: The C language maze edit and translate 目 錄 摘 要 第一章 c語言迷宮的 系統(tǒng)要求和分析 系統(tǒng)要求 系統(tǒng)要求分析 第二章 c語言迷宮 功能模塊結(jié)構(gòu) 功能模塊劃分 各個(gè)模塊的功能 第三章 主要模塊的算法說明 程序總體思路 初始化迷宮數(shù)組函數(shù) 尋找路徑函數(shù) Path 路徑樹的節(jié)點(diǎn)結(jié)構(gòu)體 第四章 開發(fā)工具的介紹 Turbo C 語言概述 C 語言的特點(diǎn) Turbo C 概述 Turbo C 的安裝和啟動(dòng) 總結(jié) 致謝 參考文獻(xiàn) 附錄 附錄 A c語言迷宮的使用說明 附 錄 B 主要代碼 第一章、 系統(tǒng)要求和分析 系統(tǒng)要求 1. 隨機(jī)產(chǎn)生一個(gè)固定大小的迷宮圖(迷宮有唯一的一個(gè)入口,一個(gè)出口); 2. 用圖形的方式畫出迷宮圖; 3. 根據(jù)該迷宮圖作出判斷,迷宮又從入口到出口的路線; 4. 如果有路線的話,找到其中的一條路線,并畫出來; 5. 用窮舉的方法找出所有的路線,找到其中步數(shù)最少的路線。 2. 開始畫面函數(shù) Wele:負(fù)責(zé)生成開始畫面。 6. 結(jié)束畫面函數(shù) GameOver:負(fù)責(zé)生成結(jié)束畫面。 2. 隨機(jī)生成迷宮內(nèi)部,具體做法是對(duì)迷宮內(nèi)部每一個(gè)點(diǎn)進(jìn)行隨機(jī)數(shù)判斷,當(dāng)滿足條件時(shí)把這個(gè)點(diǎn)標(biāo)志為圍墻,否則把這個(gè)點(diǎn)標(biāo)記為通路。 6. 因?yàn)槁窂剿阉鳂涿看卧鲩L(zhǎng)都要在所有分支上增長(zhǎng)一個(gè)節(jié)點(diǎn),故從樹根到各個(gè)末端所走的路程是相同的,而且只 有一個(gè)分支可以走到出口,而這條就是最短路徑。 /*用于記錄各個(gè)方向的屬性 */ int infoDown。 待搜索節(jié)點(diǎn)結(jié)構(gòu)體 struct leaf {struct tree *point。T 貝爾實(shí)驗(yàn)室的 Ken Thompson 根據(jù) BCPL 語言設(shè)計(jì)出較先進(jìn)的并取名為 B 的語言 , 最后導(dǎo)了 C 語言的 問世。 C 語言可以象 匯編語言一樣對(duì)位、字節(jié)和地址進(jìn)行操作 , 而這三者是計(jì)算機(jī)最基本的工作單元。 Turbo C 概述 Turbo C 的產(chǎn)生與發(fā)展 Turbo C 是美國(guó) Borland 公司的產(chǎn)品 ,Borland公司是一家專門從事軟件開發(fā)、 研制的大公司。 Turbo C 基本配置要求 Turbo C 可運(yùn)行于 IBMPC 系列微機(jī) , 包括 XT, AT 及 IBM 兼容機(jī)。 這里假定按第一種選擇進(jìn)行安裝 , 只要在安裝過程中按對(duì)盤號(hào)的提示 , 順序插 入各個(gè)軟盤 , 就可以順利地進(jìn)行安裝 , 安裝完畢將在 C 盤根目錄下建立一個(gè) TC 子目 錄 , TC 下還建立了兩個(gè)了目錄 LIB 和 INCLUDE, LIB 子目錄中存放庫文件 , INCLUDE 子目錄中存放所有頭文件。) a,d分別代表上 ,下 ,左 ,右方向。 int len=10。 /* registerbgidriver(EGAVGA_driver)。 setwritemode(XOR_PUT)。 x+=len。139。bg[i][j1]==0){ if(xstep){x=step。bg[i+1][j]==0){ if(y479step){y+=step。bg[i][j+1]==0){ if(x639step){x+=step。i。 setcolor(RED)。 switch(direc){ case 0: /* 以 3,0,1的次序嘗試 */ if(iM1amp。j。j++。 } else if(i0amp。j++。bg[i1][j]==0){ y=step。 } else if(iM1amp。 } break。bg[i+1][j]==0){ y+=step。 } else { y=step。 }/* 電腦控制結(jié)束 */ }/* main()結(jié)束 */ /* 繪制小人 */ void drawman(int x,int y,int len){ int r=len/4。 for(i=0。 } rectangle(0,0,size*b,size*a)。i++) line(i,y0,i,y1)。j++) bg[i][j]=1。 ran=(int)rand()*4。 direc=0。 direc=2。 關(guān)鍵詞 : C語言 迷宮 編譯 Abstract Along with science and technology of day by day development, calculator information knowledge drive more and more people cognition and usage, nowadays knowledge explosion of ages calculator nowise the question bee people in mon use of daily tool, to 1 usually usage The person of calculator to say, how use good the software be a very important problem, it to people daily of a lot of operation have very big of help, for a technical personnel, usually e in contact with original code, this have to academic association usage C language, although now majority of software of design is pass other high class language and adoption system integration the software edit and translate, their cores still can not get away from usage C language to set up, therefore, simple maze procedure of realization beneficial with provide a good mode of thinking in laterly of the development the item. Keyword: The C language maze edit and translate 目 錄 摘 要 第一章 c語言迷宮的 系統(tǒng)要求和分析 系統(tǒng)要求 系統(tǒng)要求分析 第二章 c語言迷宮 功能模塊結(jié)構(gòu) 功能模塊劃分 各個(gè)模塊的功能 第三章 主要模塊的算法說明 程序總體思路 初始化迷宮數(shù)組函數(shù) 尋找路徑函數(shù) Path 路徑樹的節(jié)點(diǎn)結(jié)構(gòu)體 第四章 開發(fā)工具的介紹 Turbo C 語言概述 C 語言的特點(diǎn) Turbo C 概述 Turbo C 的安裝和啟動(dòng) 總結(jié) 致謝 參考文獻(xiàn) 附錄 附錄 A c語言迷宮的使用說明 附 錄 B 主要代碼 第一章、 系統(tǒng)要求和分析 系統(tǒng)要求 1. 隨機(jī)產(chǎn)生一個(gè)固定大小的迷宮圖(迷宮有唯一的一個(gè)入口,一個(gè)出口); 2. 用圖形的方式畫出迷宮圖; 3. 根據(jù)該迷宮圖作出判斷,迷宮又從入口到出口的路線; 4. 如果有路線的話,找到其中的一條路線,并畫出來; 5. 用窮舉的方法找出所有的路線,找到其中步數(shù)最少的路線。 2. 開始畫面函數(shù) Wele:負(fù)責(zé)生成開始畫面。 6. 結(jié)束畫面函數(shù) GameOver:負(fù)責(zé)生成結(jié)束畫面。 2. 隨機(jī)生成迷宮內(nèi)部,具體做法是對(duì)迷宮內(nèi)部每一個(gè)點(diǎn)進(jìn)行隨機(jī)數(shù)判斷,當(dāng)滿足條件時(shí)把這個(gè)點(diǎn)標(biāo)志為圍墻,否則把這個(gè)點(diǎn)標(biāo)記為通路。 6. 因?yàn)槁窂剿阉鳂涿看卧鲩L(zhǎng)都要在所有分支上增長(zhǎng)一個(gè)節(jié)點(diǎn),故從樹根到各個(gè)末端所走的路程是相同的,而且只 有一個(gè)分支可以走到出口,而這條就是最短路徑。 /*用于記錄各個(gè)方向的屬性 */ int infoDown。 待搜索節(jié)點(diǎn)結(jié)構(gòu)體 struct leaf {struct tree *point。T 貝爾實(shí)驗(yàn)室的 Ken Thompson 根據(jù) BCPL 語言設(shè)計(jì)出較先進(jìn)的并取名為 B 的語言 , 最后導(dǎo)了 C 語言的 問世。 C 語言可以象 匯編語言一樣對(duì)位、字節(jié)和地址進(jìn)行操作 , 而這三者是計(jì)算機(jī)最基本的工作單元。 Turbo C 概述 Turbo C 的產(chǎn)生與發(fā)展 Turbo C 是美國(guó) Borland 公司的產(chǎn)品 ,Borland公司是一家專門從事軟件開發(fā)、 研制的大公司。 Turbo C 基本配置要求 Turbo C 可運(yùn)行于 IBMPC 系列微機(jī) , 包括 XT, AT 及 IBM 兼容機(jī)。 這里假定按第一種選擇進(jìn)行安裝 , 只要在安裝過程中按對(duì)盤號(hào)的提示 , 順序插 入各個(gè)軟盤 , 就可以順利地進(jìn)行安裝 , 安裝完畢將在 C 盤根目錄下建立一個(gè) TC 子目 錄 , TC 下還建立了兩個(gè)了目錄 LIB 和 INCLUDE, LIB 子目錄中存放庫文件 , INCLUDE 子目錄中存放所有頭文件。) a,d分別代表上 ,下 ,左 ,右方向。 int len=10。 /* registerbgidriver(EGAVGA_driver)。 setwritemode(XOR_PUT)。 x+=len。139。bg[i][j1]==0){ if(xstep){x=step。bg[i+1][j]==0){ if(y479step){y+=step。bg[i][j+1]==0){ if(x639step){x+=step。i。 setcolor(RED)。 switch(direc){ case 0: /* 以 3,0,1的次序嘗試 */ if(iM1amp。j。j++。 } else if(i0amp。j++。bg[i1][j]==0){