【正文】
安徽工業(yè)大學 畢業(yè)設計(論文)說明書 I ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ 裝 ┊ ┊ ┊ ┊ ┊ 訂 ┊ ┊ ┊ ┊ ┊ 線 ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ 摘 要 中國象棋網絡版是一款可以實現(xiàn)多人同時在線的網絡對弈 象棋軟件。 中國象棋網絡版采用 C/S 架構, 由 跨平臺的 Java 語言和 MySQ L數(shù)據(jù)庫 開發(fā) ,在開發(fā)過程中使用了多線程、 java swing、 Socket 編程以及 TCP 和 UDP 協(xié)議等技術 。 中國象棋網絡版提供了:棋友 狀態(tài)列表,弈棋邀請, 觀 看他人 弈棋,棋譜記錄和保存,在線交流,快速注冊等功能。服務端提供了:發(fā)布系統(tǒng)消息提示,服務器狀態(tài)顯示,在線棋友管理等功能 。 最后,對系統(tǒng)進行測試表明,系統(tǒng)功能達到了預期的要求, 實現(xiàn)與同類的象棋軟件如 象棋類似的功能, 具有界面友好,操作簡便,運行 穩(wěn)定 的特點 ,完成設計要求的功能。 本系統(tǒng)不足之處在于沒有實現(xiàn)人機對弈、聊天記錄的本機存儲, 將 在以后的更新版本中逐步完善。 關鍵詞 : 對弈, Java, 多線程 安徽工業(yè)大學 畢業(yè)設計(論文)說明書 II ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ 裝 ┊ ┊ ┊ ┊ ┊ 訂 ┊ ┊ ┊ ┊ ┊ 線 ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ Abstract Chinese chess online is a software can support multiplayer play chess online at the same time . The chinese chess online, based on the architecture of C/S, is developed by MySQL database and Java, a crossplatform language. In the development, multithread, Java swing, Socket programming and TCP/UDP protocol are applied. First, the newer can fast register and then get an account in the work version. The players can invite others to join, watch others playing, municate with others online and hold chessplaying records. Of course ,there exists a status bar to check the states of all chess players. Here the service releases the notes of the system information, displays the state of itself, and deal with chess players online, etc. The test of the system indicates, all the expected functions have been realized. It has the similar functions just like the chess, an online software of kind. The interface is on good terms, and the operation is easy, and also it runs stably. However, disappointingly, the puter can39。t be an opponent of the players, and the users39。 puter can39。t keep the chat records itself. These are both the weak points and the improvements will be made in the new version. Keywords: chessplaying , Java, Multithreading 安徽工業(yè)大學 畢業(yè)設計(論文)說明書 III ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ 裝 ┊ ┊ ┊ ┊ ┊ 訂 ┊ ┊ ┊ ┊ ┊ 線 ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ 目 錄 1. 前 言 ........................................................ 1 課題的研究目的和意義 ......................................... 1 開發(fā)和運行環(huán)境 ................................................ 1 開發(fā)環(huán)境 .................................................. 1 運行環(huán)境 .................................................. 1 2. JAVA 和網絡套接字技術 ............................................ 2 JAVA簡介 ...................................................... 2 JAVA圖形技術 .................................................. 2 JAVA事件響應技術 .............................................. 4 鼠標事件響應 .............................................. 4 鍵盤事件響應 .............................................. 4 網絡網絡通信技術 .............................................. 4 TCP ...................................................... 4 UDP ...................................................... 4 Socket ................................................... 5 Java 實現(xiàn) ................................................ 5 ................................. 7 中國象棋網絡版架構分析與設計 .................................. 7 中國象棋網絡版數(shù)據(jù)通信設計與 實現(xiàn) .............................. 7 通信協(xié)議選擇 .............................................. 7 數(shù)據(jù)類型分析 .............................................. 9 數(shù)據(jù)格式設計 ............................................. 11 數(shù)據(jù)通信與處理偽碼示例 ................................... 13 4.中國象棋網絡版客戶端實現(xiàn) ....................................... 16 客戶端基礎架構 ............................................... 16 客戶端 GUI 設計 ............................................... 16 弈棋主面板 ............................................... 16 用戶列表面板 ............................................. 17 棋譜記錄面板 ............................................. 17 用戶交流面板 ............................................. 17 客戶端類設計 ................................................. 18 chessboardP .............................................. 18 userP .................................................... 18 chessstateP .............................................. 19 chatP .................................................... 19 數(shù)據(jù)處理相關類 ........................................... 19 客戶端主要算法偽碼示例 ....................................... 20 棋子和棋盤狀態(tài)維護算法簡介 ............................... 20 棋盤規(guī)則馬規(guī)則偽 碼示例 ................................... 20 安徽工業(yè)大學 畢業(yè)設計(論文)說明書 IV ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ 裝 ┊ ┊ ┊ ┊ ┊ 訂 ┊ ┊ ┊ ┊ ┊ 線 ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ 棋子選擇和移動偽碼示例 ................................... 20 棋譜生成部分偽碼示例 ..................................... 21 棋局結果判定偽碼示例 ..................................... 22 通信數(shù)據(jù)處理和分發(fā)算法簡介 ............................... 22 棋子選中閃爍算法簡介 ..................................... 22 ...................................... 23 服務器端基礎架構 ............................................. 23 服務器端 GUI 設計 ............................................. 24 服務器端類設計 ............................................... 25 serverGUI ................................................ 25 serverListener ........................................... 25 chessroom ................................................ 26 databaseinterface ........................................ 26 數(shù)據(jù)庫相關開發(fā) .................