【正文】
設(shè)計 ” ,重點闡述分支限界法對兩張游戲牌進行“ 尋路 ” 的算法,來判斷兩張游戲牌能否消 去,同時給出了自動找出一對能消去的游戲牌、游戲牌重新排列、隨機發(fā)牌、處理選中游戲牌、服務(wù)端套接字處理數(shù)據(jù)包、客戶端套接字處理數(shù)據(jù)包等主要過程的算法設(shè)計。 面向?qū)ο缶幊?( Object Oriented Programming, OOP, 面向?qū)ο蟪绦蛟O(shè)計 )是一種計算機編程架構(gòu)。同時,傳統(tǒng)的軟件工程方法難于支持軟件復用??梢园呀饪臻g看作樹或者圖的形式,葉節(jié)點表示一個可能的解,從根節(jié)點到葉節(jié)點的任一路徑表示解空間的一個元素。 狀態(tài)空間搜索廣泛應(yīng)用于優(yōu)化問題中,如經(jīng)典的 “ 01 背包問題 ” 、 “ 旅行商問題 ” 、 “ 迷宮問題 ” 、 “ 最大團問題 ” 、 “ n 皇后問題 ” 等,在計算機求解的過程中,都需要進行狀態(tài)空間搜索。狀態(tài)空間搜索就是通過在狀態(tài)空間中的初始狀態(tài)出發(fā),按照一定的順序和條件對空間中的狀態(tài)進行遍歷,最終找到目標狀態(tài) [2]。由于連連看游戲具有的數(shù)學性、 動態(tài)性與知名度,也經(jīng)常拿來作為程序設(shè)計的練習題材。適度游戲,不僅能增強思維能力,提高智力,鍛煉眼力,還能起到健腦益智的效果。飽受工作壓力的人們沒有太多的時間進行復雜的游戲,而對于這種動動鼠標就能過關(guān)的游戲情有獨鐘。而網(wǎng)絡(luò)游戲又稱 “ 在線游戲 ” ,簡稱 “ 網(wǎng)游 ” 。伴著游戲產(chǎn)業(yè)日益壯大,現(xiàn)代人類日常生活中經(jīng)常用游戲來休閑娛樂,游戲市場有很大的潛力,很多國家都對游戲市場十分重視。 Branch bound algorithm。 分支限界法 。 連連看游戲是一種簡單但不失趣味性的大眾游戲,具有一定的數(shù)學性和動態(tài)性,而將普通的傳統(tǒng)單機游戲擴充為局域網(wǎng)上的多人對戰(zhàn)游戲,能使傳統(tǒng)游戲更具備對抗性和刺激性。 面向?qū)ο螅?Objectoriented, OO)開發(fā)方法是目前業(yè)界推崇的軟件開發(fā)方法,使用面向?qū)ο箝_發(fā)方法能更好地適應(yīng)當前的需求變化,容易實現(xiàn)軟件復用性、可維護性、可修改性和可擴充性。 關(guān)鍵詞 :狀態(tài)空間 。 套接字 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 path 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。 Socket 目錄 摘要 .............................................................................................................................. I Abstract .................................................................................................... II 插圖索引 ................................................................................................. VI 附表索引 ................................................................................................ VII 第 1 章 概述 .............................................................................................................. 1 連連看游戲簡介 .............................................................................................. 1 狀態(tài)空間搜索簡介 .......................................................................................... 2 面向?qū)ο蠓椒ê喗?.......................................................................................... 3 論文內(nèi)容與結(jié)構(gòu) .............................................................................................. 4 第 2 章 面向?qū)ο蠓治雠c設(shè)計 ............................................................................. 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è)計 ................................................................................. 18 棋盤類的設(shè)計 ..................................................................................... 19 繪圖器類的設(shè)計 ................................................................................. 20 控制器類的設(shè)計 ...............................................................................