【正文】
lse。 j toY。//返回 false } } } else{//向左走 for(i = toX + 1。 fromX != toX){//只能走直線 return false。 13 } if(((fromYtoY)+(toXfromX))1){//只能走一步 return false。 fromY == toY){//過河前只能直走 return false。//相眼處有棋子 } break。 } break。 } if(((fromYtoY)+(toXfromX))1){//只能走一步 return false。 } moveChessID = qizi[fromY][fromX]。 } if(toY9){//當(dāng)下邊出界時(shí) return false。//起始位置是什么棋子 int targetID。 /** * * 該類是象棋的規(guī)則類,其他類通過調(diào)用 canMove 方法給出起始位置與結(jié)束位置 * 其他類通過調(diào)用 searchAGoodMove 方法得到最當(dāng)然棋局最好的走法 * 而其中的 allPossibleMoves 方法得到的是當(dāng)前棋局的所有的走法 * */ public class GuiZe { boolean isRedGo = false。 走法類 ChessMove:該類為棋子的走法的封裝類,包含棋子的名稱、出發(fā)點(diǎn) 以及目標(biāo)點(diǎn)。 菜單界面類 MenuView:該類為菜單界面的實(shí)現(xiàn)類,負(fù)責(zé)繪制菜單界面以及對(duì)菜單界面的屏幕進(jìn)行監(jiān)聽。 各個(gè)類的簡(jiǎn)要介紹 9 ( 1) 共有類 Activity 的實(shí)現(xiàn)類 ChessActivity,該類是通過擴(kuò)展基類 Activity 得到的,是整個(gè)游戲的控制器,也是整個(gè)游戲程序的入口。 ( 4) 當(dāng)玩家單擊“幫助”菜單時(shí),將進(jìn)入幫助界面 HelpView。也就是說(shuō)在這個(gè)方式下還是說(shuō)的畫 2D 圖形。 Android 提供了一個(gè)名為 SQLiteDatabase 的類,該類封裝了一些操作數(shù)據(jù)庫(kù) 的API,使用該類可以完成對(duì)數(shù)據(jù)進(jìn)行添加 (Create)、查詢 (Retrieve)、更新 (Update)和刪除 (Delete)操作 (這些操作簡(jiǎn)稱為 CRUD)。一個(gè)應(yīng)用程序一般由多個(gè) Activity 構(gòu)成,這些Activity 之間可互相跳轉(zhuǎn),可進(jìn)行頁(yè)面間的數(shù)據(jù)傳遞。 XUL 是英文“ XML User Interface Language”的首字母縮寫。 第二部分是對(duì)局智能程序的設(shè)計(jì)。 表 Android 手機(jī)操作系統(tǒng)的發(fā)展階段 發(fā)展階段 階段特征 Android 平臺(tái)發(fā)布 TMobile 2020 年 1 季度 G1 銷售 100 萬(wàn)臺(tái) 5 MWC 華為發(fā)布 Android 手機(jī), Moto,三星, LG 計(jì)劃 2020年下半年推出 Android 手機(jī) 2020 獲得 Orange, Vodafone, O2, Telefonica 支持 2020 進(jìn)軍上網(wǎng)本 研究的目標(biāo)與內(nèi)容 研究目標(biāo) 本項(xiàng)目主要研究的目標(biāo)分為:程序設(shè)計(jì)思想實(shí)踐改進(jìn)目標(biāo)、 Android 平臺(tái)手機(jī)開發(fā)技術(shù)的研究目標(biāo)。這樣中國(guó)象棋休閑游戲?qū)⒉辉谑且粋€(gè)功能單一界面枯燥的游戲,而是一個(gè)較完善的休閑游戲。手機(jī)操作系統(tǒng)正朝著高處理能力、多功能、智能化的方向發(fā)展。 I will be in the key technology used in the realization of a prehensive introduction. Keywords: Network of games。 build software models using UML。 本文詳細(xì)系統(tǒng)地闡述了在 Android 平臺(tái)上,面向?qū)ο蟮能浖_發(fā)思想對(duì)Chess 游戲系統(tǒng)的分析、設(shè)計(jì)及實(shí)現(xiàn)過程。 系統(tǒng)采用面向?qū)ο蟮木幊趟枷脒M(jìn)行構(gòu)思與分析設(shè)計(jì);使用 UML 構(gòu)建軟件模型;使用 MVC 架構(gòu)模式實(shí)現(xiàn)系統(tǒng)的整體架構(gòu)及各模塊之間的接口設(shè)計(jì);在系統(tǒng)的實(shí)踐過程中還采用了部分 GoF 的設(shè)計(jì)模式進(jìn)行編碼與開發(fā)。 關(guān)鍵詞 : 聯(lián)網(wǎng)對(duì)弈;中國(guó)象棋;手機(jī)游戲 ; Android 平臺(tái) 2 ABSTRACT: CnChess is a Chinese Chess game that running on the Android support many of the features such as playing games through the work, realtime chat, and play chess records of casual mobile games. The CnChess game is objectoriented programming design and analysis of the idea of thinking。s design patterns to coding and development. This paper systematically expounded in the Android platform, the application of MVC pattern and hierarchical structure of objectoriented software development thoughts Chess game system analysis, design and implementation process. Practice in the course of the project, mainly used in the following technologies: cell phones primarily use XML layout design, process and life cycle management submodule uses the Activity process control, data storage areas using a lightweight database SQLite, wrok munication Some use the XMPP instant messaging protocol for data transmission, public debate of the frame using a mobile phone 2D graphics programming. The first part of this paper will briefly introduce the system based on relevant industry information and technical knowledge, the latter part of each module in the system。 Android platform 3 目 錄 一、 前言 ……………………… … ……………………………………… .… 4 ………………… … ……………………………………… ..… 4 ………………… … ………………………… .… .… 4 手機(jī)操作系統(tǒng)的發(fā)展歷程 …………… .…………… ..… .4 …………………………………………… ..… 5 研究目標(biāo) ……………… … ………………………………… .… 5 研究主要內(nèi)容 ……………… … ……………………………… .5 二、 Android 程序設(shè)計(jì)相關(guān)技術(shù)概論 ……………………… … ……… ..6 XUL 界面布局 ……………… … ………… ………………… .… .6 Android 的 Activity 組件 ………… … ……………………… 6 SQLite 數(shù)據(jù)庫(kù) ……………… … ……………………………… .7 Android 2D 圖形編程 …………… … ………………………… 7 三、 游戲所需類的分析與實(shí)現(xiàn) ……………………… … ……………… 6 ………………………………………… ..…… 8 …………… … ………………… ..………… 8 ………………… .…………… .… .10 四、 論文總結(jié) ………… …………… … ………………………………… 27 五、 參考文獻(xiàn) ……………………… … ………………………………… 28 致謝 ……………………… … …………………………………………… ...29