![五子棋程序設(shè)計(jì)報(bào)告_第1頁](http://file3.renrendoc.com/fileroot_temp3/2022-2/16/a311b04b-3b7b-4af3-bcdd-918c5bf0b390/a311b04b-3b7b-4af3-bcdd-918c5bf0b3901.gif)
![五子棋程序設(shè)計(jì)報(bào)告_第2頁](http://file3.renrendoc.com/fileroot_temp3/2022-2/16/a311b04b-3b7b-4af3-bcdd-918c5bf0b390/a311b04b-3b7b-4af3-bcdd-918c5bf0b3902.gif)
![五子棋程序設(shè)計(jì)報(bào)告_第3頁](http://file3.renrendoc.com/fileroot_temp3/2022-2/16/a311b04b-3b7b-4af3-bcdd-918c5bf0b390/a311b04b-3b7b-4af3-bcdd-918c5bf0b3903.gif)
![五子棋程序設(shè)計(jì)報(bào)告_第4頁](http://file3.renrendoc.com/fileroot_temp3/2022-2/16/a311b04b-3b7b-4af3-bcdd-918c5bf0b390/a311b04b-3b7b-4af3-bcdd-918c5bf0b3904.gif)
![五子棋程序設(shè)計(jì)報(bào)告_第5頁](http://file3.renrendoc.com/fileroot_temp3/2022-2/16/a311b04b-3b7b-4af3-bcdd-918c5bf0b390/a311b04b-3b7b-4af3-bcdd-918c5bf0b3905.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、五子棋程序設(shè)計(jì)報(bào)告 班 級(jí):姓 名: 學(xué) 號(hào):指導(dǎo)老師: 2012/1/07一、 課程設(shè)計(jì)題目與要求題目:網(wǎng)絡(luò)五子棋游戲。功能要求:該軟件應(yīng)包括服務(wù)器端程序和客戶端程序兩個(gè)部分,要求實(shí)現(xiàn)的功能如下??蛻舳斯δ芤螅海?) 友好的用戶登錄界面設(shè)計(jì);(2) 登錄服務(wù)器后,請(qǐng)求用戶列表;(3) 相其他用戶發(fā)出邀請(qǐng),做游戲;(4) 當(dāng)用戶加入或離開時(shí),客戶端接受服務(wù)器發(fā)送的成員列表,更新用戶列表;(5) 當(dāng)用戶開始游戲或游戲結(jié)束時(shí),服務(wù)器通知客戶端用戶更新該用戶狀態(tài),客戶端接受該消息后,更新該用戶狀態(tài);(6) 根據(jù)五子棋的游戲規(guī)則實(shí)現(xiàn)五子棋的游戲功能,包括游戲判斷、畫圖等。服務(wù)器端功能要求:(1) 服
2、務(wù)器接受用戶注冊(cè)信息,服務(wù)器最多容納64 個(gè)成員,成員信息包括:用戶名、IP 地址、端口和狀態(tài),當(dāng)服務(wù)器退出時(shí),保存用戶信息;(2) 當(dāng)用戶加入或退出,服務(wù)器向所有用戶發(fā)送成員列表,通知客戶端更新成員列表;(3) 當(dāng)用戶開始游戲或者結(jié)束游戲時(shí),服務(wù)器通知其他用戶更新該用戶狀態(tài),通知客戶端更新成員狀態(tài);(4) 和客戶端一起維護(hù)游戲的進(jìn)行,發(fā)送游戲信息。二、需求分析以及模型框架1. 五子棋游戲是一歷史悠久,對(duì)抗性強(qiáng),技巧性高的棋類游戲。而且我對(duì)五子棋有著獨(dú)特的愛好,希望自己也可以編寫出一款可以實(shí)現(xiàn)人機(jī)對(duì)戰(zhàn)的五子棋游戲。把自己的思想付給電腦,讓自己有些成就感,給自己繼續(xù)努力的動(dòng)力。借此次課程設(shè)計(jì)的機(jī)
3、會(huì),把想法變成現(xiàn)實(shí)。而且五子棋不僅能增強(qiáng)思維能力,提高智力,而且富含哲理,有助于修身養(yǎng)性。五子棋既有現(xiàn)代休閑的明顯特征“短、平、快”,又有古典哲學(xué)的高深學(xué)問“陰陽易理”;它既有簡單易學(xué)的特性,為人民群眾所喜聞樂見,又有深?yuàn)W的技巧和高水平的國際性比賽;它的棋文化源淵流長,具有東方的神秘和西方的直觀;既有“場”的概念,亦有“點(diǎn)”的連接。它是中西文化的交流點(diǎn),是古今哲理的結(jié)晶。所以此次c+課程設(shè)計(jì)選擇五子棋這個(gè)題目。2程序所實(shí)現(xiàn)的功能通過給電腦賦予人工智能,利用電腦運(yùn)算速度快的特點(diǎn),結(jié)合五子棋的游戲規(guī)則,給電腦設(shè)定固定的掃描方式,設(shè)定權(quán)值,使電腦能夠選擇最合適的落子點(diǎn),然后調(diào)用加載已做好的棋盤棋子圖
4、像,最終實(shí)現(xiàn)簡單的人機(jī)對(duì)弈。3. 該游戲?yàn)槠胀ㄍ婕沂褂?,只要連成五子即獲勝.三、設(shè)計(jì)內(nèi)容1 根據(jù) 所選題目,給出模塊圖主界面開始游戲重新開始游戲游戲結(jié)束落子判斷輸贏結(jié)束界面初始化棋盤初始化棋盤2 畫出主程序及其主要模塊的流程圖游戲開始初始化棋盤點(diǎn)鼠標(biāo)左鍵落子加載棋盤圖片五子連珠?掃描棋盤,根據(jù)預(yù)設(shè)權(quán)值,選擇最佳地點(diǎn)落子五子連珠?游戲結(jié)束加載棋子圖片到棋盤加載棋子圖片到棋盤是否是轉(zhuǎn)1否四、相關(guān)截圖:1、 開始游戲的時(shí)候,會(huì)根據(jù)提示來選擇游模式。2、如果選的對(duì)手是電腦。則會(huì)提示是哪個(gè)級(jí)別的。初級(jí)、中級(jí)和高級(jí)。3、系統(tǒng)會(huì)根據(jù)你下棋子來判斷來怎么下。4、在任何一方下到五個(gè)子的時(shí)候,系統(tǒng)會(huì)提示輸贏,以及
5、下棋過程中有無悔棋,和總共下了幾手。五、相關(guān)代碼:1.Pente.h#if !defined(AFX_PENTE_H_9A01CC66_D589_11D1_92B0_000021003EA5_INCLUDED_)#define AFX_PENTE_H_9A01CC66_D589_11D1_92B0_000021003EA5_INCLUDED_#if _MSC_VER = 1000#pragma once#endif / _MSC_VER = 1000#ifndef _AFXWIN_H_#error include stdafx.h before including this PCH#endif
6、#include resource.h/ main symbols#define MODE_WITH_COMPUTER0#define MODE_2PLAYER1#define MODE_2PLAYER_NET2#define MODE_2PLAYER_MODEM3#define ID_TIMER_NET100#define MESSAGE_SIZE512/ CPenteApp:/ See Pente.cpp for the implementation of this class/class CPenteApp : public CWinApppublic:CPenteApp();/ Ove
7、rrides/ ClassWizard generated virtual function overrides/AFX_VIRTUAL(CPenteApp)public:virtual BOOL InitInstance();/AFX_VIRTUAL/ Implementation/AFX_MSG(CPenteApp)/ NOTE - the ClassWizard will add and remove member functions here./ DO NOT EDIT what you see in these blocks of generated code !/AFX_MSGDE
8、CLARE_MESSAGE_MAP();/AFX_INSERT_LOCATION/ Microsoft Developer Studio will insert additional declarations immediately before the previous line.#endif / !defined2. Pente.cpp :#include stdafx.h#include Pente.h#include PenteDlg.h#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _
9、FILE_;#endif/ CPenteAppBEGIN_MESSAGE_MAP(CPenteApp, CWinApp)/AFX_MSG_MAP(CPenteApp)/ NOTE - the ClassWizard will add and remove mapping macros here./ DO NOT EDIT what you see in these blocks of generated code!/AFX_MSGON_COMMAND(ID_HELP, CWinApp:OnHelp)END_MESSAGE_MAP()/ CPenteApp constructionCPenteA
10、pp:CPenteApp()/ TODO: add construction code here,/ Place all significant initialization in InitInstance/ The one and only CPenteApp objectCPenteApp theApp;/ CPenteApp initializationBOOL CPenteApp:InitInstance()/ stardard initialization begin.AfxEnableControlContainer();/ Standard initialization/ If
11、you are not using these features and wish to reduce the size/ of your final executable, you should remove from the following/ the specific initialization routines you do not need.#ifdef _AFXDLLEnable3dControls();/ Call this when using MFC in a shared DLL#elseEnable3dControlsStatic();/ Call this when
12、 linking to MFC statically#endifSetRegistryKey(_T(MultiMediaGuid);CPenteDlg dlg;m_pMainWnd = &dlg;int nResponse = dlg.DoModal();if (nResponse = IDOK)/ TODO: Place code here to handle when the dialog is/ dismissed with OKelse if (nResponse = IDCANCEL)/ TODO: Place code here to handle when the dialog
13、is/ dismissed with Cancel/ Since the dialog has been closed, return FALSE so that we exit the/ application, rather than start the applications message pump.return FALSE;3.AboutDlg.h#if !defined(AFX_ABOUTDLG_H_701A5C62_DBBE_11D1_92B0_000021003EA5_INCLUDED_)#define AFX_ABOUTDLG_H_701A5C62_DBBE_11D1_92
14、B0_000021003EA5_INCLUDED_#if _MSC_VER = 1000#pragma once#endif / _MSC_VER = 1000/ AboutDlg.h : header file/ CAboutDlg dialogclass CAboutDlg : public CDialog/ Constructionpublic:CAboutDlg(CWnd* pParent = NULL); / standard constructor/ Dialog Data/AFX_DATA(CAboutDlg)enum IDD = IDD_ABOUTDLG ;/ NOTE: th
15、e ClassWizard will add data members here/AFX_DATA/ Overrides/ ClassWizard generated virtual function overrides/AFX_VIRTUAL(CAboutDlg)protected:virtual void DoDataExchange(CDataExchange* pDX); / DDX/DDV support/AFX_VIRTUAL/ Implementationprotected:/ Generated message map functions/AFX_MSG(CAboutDlg)v
16、irtual BOOL OnInitDialog();/AFX_MSGDECLARE_MESSAGE_MAP();/AFX_INSERT_LOCATION/ Microsoft Developer Studio will insert additional declarations immediately before the previous line.#endif / !defined4. AboutDlg.cpp : #include stdafx.h#include #include #include #include resource.h#include HelperAPI.h#in
17、clude Globalvar.h#include AboutDlg.h#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endif/ CAboutDlg dialogCAboutDlg:CAboutDlg(CWnd* pParent /*=NULL*/): CDialog(:g_bChinese ? IDD_ABOUTDLG1 : IDD_ABOUTDLG, pParent)/AFX_DATA_INIT(CAboutDlg)/ NOTE: the ClassWizard will
18、 add member initialization here/AFX_DATA_INITvoid CAboutDlg:DoDataExchange(CDataExchange* pDX)CDialog:DoDataExchange(pDX);/AFX_DATA_MAP(CAboutDlg)/ NOTE: the ClassWizard will add DDX and DDV calls here/AFX_DATA_MAPBEGIN_MESSAGE_MAP(CAboutDlg, CDialog)/AFX_MSG_MAP(CAboutDlg)/AFX_MSG_MAPEND_MESSAGE_MA
19、P()/ CAboutDlg message handlersBOOL CAboutDlg:OnInitDialog() CDialog:OnInitDialog();HICON hIcon = AfxGetApp()-LoadIcon(IDR_MAINFRAME);SetIcon(hIcon, TRUE);/ Set big iconSetIcon(hIcon, FALSE);/ Set small iconCString str;/ fill memory infoMEMORYSTATUS MemStat;MemStat.dwLength = sizeof(MEMORYSTATUS);Gl
20、obalMemoryStatus(&MemStat);/ Total Physical memstr.Format(%lu KB, MemStat.dwTotalPhys / 1024L);SetDlgItemText(IDC_PHYSICAL_MEM, str);/ Free Physical memstr.Format(%lu KB, MemStat.dwAvailPhys / 1024L);SetDlgItemText(IDC_AVAIL_MEM, str);/ Free Virtual memstr.Format(%lu KB, MemStat.dwAvailVirtual / 102
21、4L);SetDlgItemText(IDC_AVAIL_VIRTUAL_MEM, str);/ fill CPU infoSYSTEM_INFO SysInfo;GetSystemInfo(&SysInfo);switch (SysInfo.dwProcessorType)case PROCESSOR_INTEL_486:str = Intel 80486;break;case PROCESSOR_INTEL_PENTIUM:str = Intel Pentium;break;default:str = ;break;SetDlgItemText(IDC_CPU, str);/ fill O
22、S infoOSVERSIONINFO OsInfo;OsInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);if (GetVersionEx(&OsInfo)/ platformswitch (OsInfo.dwPlatformId)case VER_PLATFORM_WIN32_WINDOWS:str = Windows 95;break;case VER_PLATFORM_WIN32_NT:str = Windows NT;break;default:str = ;break;SetDlgItemText(IDC_OS, str);/ ver
23、sion and languagechar szVer512;GetWindowsVersion(LPSTR)szVer);str.Format(%ld.%ld, %s, OsInfo.dwMajorVersion, OsInfo.dwMinorVersion, szVer);SetDlgItemText(IDC_VERSION, str);/ fill disk informationchar szWindowsPath_MAX_PATH;GetWindowsDirectory(szWindowsPath, _MAX_PATH);ULARGE_INTEGER TotalNumberOfByt
24、es, TotalNumberOfFreeBytes;GetDiskFreeSpaceEx(LPSTR)szWindowsPath,NULL,&TotalNumberOfBytes,&TotalNumberOfFreeBytes);/ total spacestr.Format(%lu KB, TotalNumberOfBytes.QuadPart / 1024L);SetDlgItemText(IDC_TOTAL_SPACE, str);/ free spacestr.Format(%lu KB, TotalNumberOfFreeBytes.QuadPart / 1024L);SetDlg
25、ItemText(IDC_FREE_SPACE, str); PlaySound(IDSOUND_WELCOME); return TRUE; / return TRUE unless you set the focus to a control / EXCEPTION: OCX Property Pages should return FALSE5. BestDlg.cpp : implementation file/#include stdafx.h#include Pente.h#include Globalvar.h#include BestDlg.h#ifdef _DEBUG#def
26、ine new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endif/ CBestDlg dialogCBestDlg:CBestDlg(CWnd* pParent /*=NULL*/): CDialog(:g_bChinese ? IDD_BEST1 : IDD_BEST)/AFX_DATA_INIT(CBestDlg)/ NOTE: the ClassWizard will add member initialization here/AFX_DATA_INITvoid CBestDlg:DoDataExchange(
27、CDataExchange* pDX)CDialog:DoDataExchange(pDX);/AFX_DATA_MAP(CBestDlg)/ NOTE: the ClassWizard will add DDX and DDV calls here/AFX_DATA_MAPBEGIN_MESSAGE_MAP(CBestDlg, CDialog)/AFX_MSG_MAP(CBestDlg)ON_BN_CLICKED(IDC_RESTARTCOUNT, OnRestartcount)/AFX_MSG_MAPEND_MESSAGE_MAP()/ CBestDlg message handlersB
28、OOL CBestDlg:OnInitDialog() CDialog:OnInitDialog();m_hIcon = AfxGetApp()-LoadIcon(IDR_MAINFRAME);SetIcon(m_hIcon, TRUE);/ Set big iconSetIcon(m_hIcon, FALSE);/ Set small iconName1Edit().SetWindowText(g_strName1);Name2Edit().SetWindowText(g_strName2);Name3Edit().SetWindowText(g_strName3);char str4; w
29、sprintf(str,%d,g_nTime1);Time1Edit().SetWindowText(str);wsprintf(str,%d,g_nTime2);Time2Edit().SetWindowText(str);wsprintf(str,%d,g_nTime3);Time3Edit().SetWindowText(str);return TRUE; / return TRUE unless you set the focus to a control / EXCEPTION: OCX Property Pages should return FALSEvoid CBestDlg:
30、OnRestartcount() g_strName1 = Anonymous;g_strName2 = Anonymous;g_strName3 = Anonymous;g_nTime1 = 225;g_nTime2 = 225;g_nTime3 = 225;Name1Edit().SetWindowText(g_strName1);Name2Edit().SetWindowText(g_strName2);Name3Edit().SetWindowText(g_strName3);Time1Edit().SetWindowText(225);Time2Edit().SetWindowTex
31、t(225);Time3Edit().SetWindowText(225);6. #if !defined(AFX_BESTDLG_H_0740A355_D3AB_11D1_A77A_444553540000_INCLUDED_)#define AFX_BESTDLG_H_0740A355_D3AB_11D1_A77A_444553540000_INCLUDED_#if _MSC_VER = 1000#pragma once#endif / _MSC_VER = 1000/ BestDlg.h : header file/ CBestDlg dialogclass CBestDlg : pub
32、lic CDialog/ Constructionpublic:CBestDlg(CWnd* pParent = NULL); / standard constructor/ Dialog Data/AFX_DATA(CBestDlg)enum IDD = IDD_BEST ;/ NOTE: the ClassWizard will add data members here/AFX_DATAHICON m_hIcon;/ Overrides/ ClassWizard generated virtual function overrides/AFX_VIRTUAL(CBestDlg)protected:virtua
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 理財(cái)師視角下的保險(xiǎn)資產(chǎn)配置研究
- 環(huán)境因素對(duì)人類健康風(fēng)險(xiǎn)的評(píng)估研究
- 拍賣行業(yè)公共服務(wù)創(chuàng)新實(shí)踐案例分享考核試卷
- 珠寶行業(yè)的國際合作與交流平臺(tái)建設(shè)
- 構(gòu)建企業(yè)級(jí)網(wǎng)絡(luò)安全應(yīng)急響應(yīng)機(jī)制
- 2025年01月珠海高新技術(shù)產(chǎn)業(yè)開發(fā)區(qū)創(chuàng)新創(chuàng)業(yè)服務(wù)中心招4人筆試歷年典型考題(歷年真題考點(diǎn))解題思路附帶答案詳解
- 搪瓷行業(yè)全球市場布局策略考核試卷
- 現(xiàn)代辦公環(huán)境下的電商物流倉儲(chǔ)管理方案
- 咖啡館經(jīng)營策略考核試卷
- 健身器材行業(yè)數(shù)字化工廠規(guī)劃與智能制造實(shí)踐考核試卷
- 2024年法律職業(yè)資格考試(試卷二)客觀題試題及解答參考
- 2024年注冊(cè)建筑師-二級(jí)注冊(cè)建筑師考試近5年真題附答案
- 五年級(jí)口算題卡每天100題帶答案
- 食品感官檢驗(yàn):品評(píng)人員的篩選與培訓(xùn)
- 2024-2030年中國會(huì)務(wù)行業(yè)市場發(fā)展分析及發(fā)展趨勢與投資風(fēng)險(xiǎn)預(yù)測研究報(bào)告
- 醫(yī)院緊急醫(yī)療救援管理制度
- 企業(yè)落實(shí)食品安全主體責(zé)任監(jiān)督管理制度
- 咨詢與評(píng)估管理制度
- 中醫(yī)辨證-八綱辨證(中醫(yī)學(xué)課件)
- CJT 313-2009 生活垃圾采樣和分析方法
- 2024年長沙市中考數(shù)學(xué)真題試卷及答案
評(píng)論
0/150
提交評(píng)論