【正文】
本科畢業(yè)論文(設(shè)計(jì)) 題 目 基于分支限界法的連連看局域網(wǎng)對戰(zhàn)游戲的開發(fā) 作 者 學(xué) 院 信息科學(xué)與工程學(xué)院 專 業(yè) 計(jì)算機(jī)科學(xué)與技術(shù) 學(xué) 號 指導(dǎo)教師 二〇一三年五月十五日 摘要 分支限界法是一種廣泛使用的狀態(tài)空間搜索算法,這種算法常以廣度優(yōu)先或以最小耗費(fèi)(最大效益)優(yōu)先的方式來搜索問題的狀態(tài)空間,在搜索過程中,利用剪枝來提高搜索效率,分支限界法與回溯法、 A*算法等常用于游戲中的“ 尋路 ” 過程。 面向?qū)ο螅?Objectoriented, OO)開發(fā)方法是目前業(yè)界推崇的軟件開發(fā)方法,使用面向?qū)ο箝_發(fā)方法能更好地適應(yīng)當(dāng)前的需求變化,容易實(shí)現(xiàn)軟件復(fù)用性、可維護(hù)性、可修改性和可擴(kuò)充性。 連連看游戲是一種簡單但不失趣味性的大眾游戲,具有一定的數(shù)學(xué)性和動態(tài)性,而將普通的傳統(tǒng)單機(jī)游戲擴(kuò)充為局域網(wǎng)上的多人對戰(zhàn)游戲,能使傳統(tǒng)游戲更具備對抗性和刺激性。 本文研究以面向?qū)ο蠹夹g(shù)為主要開發(fā)方法,以分支限界法作為兩張游戲牌的尋路算法,將傳統(tǒng)的連連看單機(jī)游戲擴(kuò)充為局域網(wǎng)上的雙人對戰(zhàn)游戲,重點(diǎn)闡述了分支限界法與面相對象開發(fā)思想在連連看局域網(wǎng)對戰(zhàn)游戲中的應(yīng)用。程序開發(fā)出來后, 不僅正確實(shí)現(xiàn)了相關(guān)的功能和性能,而且具有良好的穩(wěn)定性、可維護(hù)性和可擴(kuò)充性,證明了分支限界法和面向?qū)ο蠹夹g(shù)在在連連看局域網(wǎng)對戰(zhàn)游戲開發(fā)中的可行性。 關(guān)鍵詞 :狀態(tài)空間 。 分支限界法 。 連連看 。 面向?qū)ο?。 套接字 Abstract Branch and bound method is an algorithm that used widely in statespace search. This algorithm based on breadthfirst or with the way (maximum benefit) in favor of smallest cost to search the problem in State space . During the search ,pruning is used to improve the search efficiency . The branch and bound method , the backtrack method ,and the A* algorithm is monly used in the games of pa th finding process. Objectoriented (Objectoriented, OO) development methods are industry respected software development methods. Objectoriented development methods can better adapt to change in demand, easy to implement software reusability, maintainability, Modifiability, and scalability. Lianliankan games is a simple yet fun popular games, with a certain mathematical and dynamical .while the expansion of the mon traditional games for multiplayer fighting game on the LAN, make the traditional game have a confrontational and provocative. This articles’ research use the objectoriented technology as the main development methods and take the branch and bound method as two game pathfinding algorithms. The traditional lianliankan games expanded into a double play against the game on the LAN ,focused on the application of branch and bound method and the objectoriented development methods in the LAN battle game. The developed program not only implement the functionality and performance properly, but also has good stability, maintainability and scalability. It proves that the bound method and objectoriented technology is feasible in the multiplayer fighting game on the LAN. Keywords: state space。 Branch bound algorithm。 Lianliankan game。 objectoriented。 Socket 目錄 摘要 ...............................................................................................................................I Abstract ................................................................................................. II 插圖索引 ...............................................................................................VI 附表索引 ............................................................................................. VII 第 1 章 概述 .............................................................................................................. 1 連連看游戲簡介 .............................................................................................. 1 狀態(tài)空間搜索簡介 .......................................................................................... 2 面向?qū)ο蠓椒ê喗?.......................................................................................... 3 論文內(nèi)容與結(jié)構(gòu) .............................................................................................. 4 第 2 章 面向?qū)ο蠓治雠c設(shè)計(jì) ............................................................................. 5 用例圖建模 ...................................................................................................... 5 用例建模與用例圖的概念 ................................................................... 5 游戲的用例圖 ....................................................................................... 5 用例說明 ............................................................................................... 6 活動圖建模 ...................................................................................................... 9 活動圖的概念 ....................................................................................... 9 游戲的活動圖 ....................................................................................... 9 開發(fā)工具的選擇 ................................................................................. 11 狀態(tài)圖建模 .................................................................................................... 12 狀態(tài)圖的概念 ..................................................................................... 12 游戲牌對象的狀態(tài)圖 ......................................................................... 12 棋盤對象的狀態(tài)圖 ............................................................................. 13 對象交互建模 ................................................................................................ 13 交互建模與順序圖的概念 ................................................................. 13 程序結(jié)構(gòu)介紹 ..................................................................................... 13 “選中游戲牌 ” 過程的順序圖 ........................................................... 14 類圖建模 ........................................................................................................ 17 類圖的相關(guān)概念 ................................................................................. 17 游戲的類關(guān)系圖 ................................................................................. 17 游戲牌類的設(shè)計(jì) ................................................................................. 18 棋盤類的設(shè)計(jì) ..................................................................................... 19 繪圖器類的設(shè)計(jì) ................................................................................. 20 控制器類的設(shè)計(jì) ................................................................................. 21 客戶套接字類的設(shè)計(jì) ......................................................................... 22 監(jiān)聽套接字類的設(shè)計(jì) ......................................