欢迎来到冰点文库! | 帮助中心 分享价值,成长自我!
冰点文库
全部分类
  • 临时分类>
  • IT计算机>
  • 经管营销>
  • 医药卫生>
  • 自然科学>
  • 农林牧渔>
  • 人文社科>
  • 工程科技>
  • PPT模板>
  • 求职职场>
  • 解决方案>
  • 总结汇报>
  • ImageVerifierCode 换一换
    首页 冰点文库 > 资源分类 > DOCX文档下载
    分享到微信 分享到微博 分享到QQ空间

    五子棋程序设计报告.docx

    • 资源ID:10896196       资源大小:291.39KB        全文页数:22页
    • 资源格式: DOCX        下载积分:3金币
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录
    二维码
    微信扫一扫登录
    下载资源需要3金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP,免费下载
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    五子棋程序设计报告.docx

    1、五子棋程序设计报告五子棋程序设计报告 班 级:姓 名: 学 号:指导老师: 2012/1/07一、 课程设计题目与要求题目:网络五子棋游戏。功能要求:该软件应包括服务器端程序和客户端程序两个部分,要求实现的功能如下。客户端功能要求:(1) 友好的用户登录界面设计;(2) 登录服务器后,请求用户列表;(3) 相其他用户发出邀请,做游戏;(4) 当用户加入或离开时,客户端接受服务器发送的成员列表,更新用户列表;(5) 当用户开始游戏或游戏结束时,服务器通知客户端用户更新该用户状态,客户端接受该消息后,更新该用户状态;(6) 根据五子棋的游戏规则实现五子棋的游戏功能,包括游戏判断、画图等。服务器端功

    2、能要求:(1) 服务器接受用户注册信息,服务器最多容纳64 个成员,成员信息包括:用户名、IP 地址、端口和状态,当服务器退出时,保存用户信息;(2) 当用户加入或退出,服务器向所有用户发送成员列表,通知客户端更新成员列表;(3) 当用户开始游戏或者结束游戏时,服务器通知其他用户更新该用户状态,通知客户端更新成员状态;(4) 和客户端一起维护游戏的进行,发送游戏信息。二、 需求分析以及模型框架1. 五子棋游戏是一历史悠久,对抗性强,技巧性高的棋类游戏。而且我对五子棋有着独特的爱好,希望自己也可以编写出一款可以实现人机对战的五子棋游戏。把自己的思想付给电脑,让自己有些成就感,给自己继续努力的动力

    3、。借此次课程设计的机会,把想法变成现实。而且五子棋不仅能增强思维能力,提高智力,而且富含哲理,有助于修身养性。五子棋既有现代休闲的明显特征“短、平、快”,又有古典哲学的高深学问“阴阳易理”;它既有简单易学的特性,为人民群众所喜闻乐见,又有深奥的技巧和高水平的国际性比赛;它的棋文化源渊流长,具有东方的神秘和西方的直观;既有“场”的概念,亦有“点”的连接。它是中西文化的交流点,是古今哲理的结晶。所以此次c+课程设计选择五子棋这个题目。2 程序所实现的功能通过给电脑赋予人工智能,利用电脑运算速度快的特点,结合五子棋的游戏规则,给电脑设定固定的扫描方式,设定权值,使电脑能够选择最合适的落子点,然后调用

    4、加载已做好的棋盘棋子图像,最终实现简单的人机对弈。3. 该游戏为普通玩家使用,只要连成五子即获胜.三、设计内容1 根据 所选题目,给出模块图2 画出主程序及其主要模块的流程图四、相关截图:1、 开始游戏的时候,会根据提示来选择游模式。2、如果选的对手是电脑。则会提示是哪个级别的。初级、中级和高级。3、系统会根据你下棋子来判断来怎么下。4、在任何一方下到五个子的时候,系统会提示输赢,以及下棋过程中有无悔棋,和总共下了几手。五、相关代码:1.Pente.h#if !defined(AFX_PENTE_H_9A01CC66_D589_11D1_92B0_000021003EA5_INCLUDED_)

    5、#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 file for PCH#endif#include resource.h / main symbols#define MODE_WITH_COMPUTER 0#define MODE_2PLAYER 1#define MODE

    6、_2PLAYER_NET 2#define MODE_2PLAYER_MODEM 3#define ID_TIMER_NET 100#define MESSAGE_SIZE 512/ CPenteApp:/ See Pente.cpp for the implementation of this class/class CPenteApp : public CWinApppublic: CPenteApp();/ Overrides / ClassWizard generated virtual function overrides /AFX_VIRTUAL(CPenteApp) public

    7、: 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_MSG DECLARE_MESSAGE_MAP();/AFX_INSERT_LOCATION/ Microsoft Developer Studio will inse

    8、rt 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 = _FILE_;#endif/ CPenteAppBEGIN_MESSAGE_MAP(CPenteApp, CWinApp) /AFX_MSG_MAP(CPen

    9、teApp) / NOTE - the ClassWizard will add and remove mapping macros here. / DO NOT EDIT what you see in these blocks of generated code! /AFX_MSG ON_COMMAND(ID_HELP, CWinApp:OnHelp)END_MESSAGE_MAP()/ CPenteApp constructionCPenteApp:CPenteApp() / TODO: add construction code here, / Place all significan

    10、t initialization in InitInstance/ The one and only CPenteApp objectCPenteApp theApp;/ CPenteApp initializationBOOL CPenteApp:InitInstance() / stardard initialization begin. AfxEnableControlContainer(); / Standard initialization / If you are not using these features and wish to reduce the size / of y

    11、our final executable, you should remove from the following / the specific initialization routines you do not need.#ifdef _AFXDLL Enable3dControls(); / Call this when using MFC in a shared DLL#else Enable3dControlsStatic(); / Call this when linking to MFC statically#endif SetRegistryKey(_T(MultiMedia

    12、Guid); CPenteDlg dlg; m_pMainWnd = &dlg; int nResponse = dlg.DoModal(); if (nResponse = IDOK) / TODO: Place code here to handle when the dialog is / dismissed with OK else if (nResponse = IDCANCEL) / TODO: Place code here to handle when the dialog is / dismissed with Cancel / Since the dialog has be

    13、en 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_92B0_000021003EA5_INCLUDED_#if _MSC_VER = 1000#pra

    14、gma 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: the ClassWizard will add data members here /AF

    15、X_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) virtual BOOL OnInitDialog(); /AFX_MS

    16、G DECLARE_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#include Globalvar.h#include AboutDl

    17、g.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 add member initialization her

    18、e /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_MAP()/ CAboutDlg message

    19、handlersBOOL CAboutDlg:OnInitDialog() CDialog:OnInitDialog(); HICON hIcon = AfxGetApp()-LoadIcon(IDR_MAINFRAME); SetIcon(hIcon, TRUE); / Set big icon SetIcon(hIcon, FALSE); / Set small icon CString str; / fill memory info MEMORYSTATUS MemStat; MemStat.dwLength = sizeof(MEMORYSTATUS); GlobalMemorySta

    20、tus(&MemStat); / Total Physical mem str.Format(%lu KB, MemStat.dwTotalPhys / 1024L); SetDlgItemText(IDC_PHYSICAL_MEM, str); / Free Physical mem str.Format(%lu KB, MemStat.dwAvailPhys / 1024L); SetDlgItemText(IDC_AVAIL_MEM, str); / Free Virtual mem str.Format(%lu KB, MemStat.dwAvailVirtual / 1024L);

    21、SetDlgItemText(IDC_AVAIL_VIRTUAL_MEM, str); / fill CPU info SYSTEM_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

    22、); / fill OS info OSVERSIONINFO OsInfo; OsInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if (GetVersionEx(&OsInfo) / platform switch (OsInfo.dwPlatformId) case VER_PLATFORM_WIN32_WINDOWS: str = Windows 95; break; case VER_PLATFORM_WIN32_NT: str = Windows NT; break; default: str = ; break; SetDlgI

    23、temText(IDC_OS, str); / version and language char szVer512; GetWindowsVersion(LPSTR)szVer); str.Format(%ld.%ld, %s, OsInfo.dwMajorVersion, OsInfo.dwMinorVersion, szVer); SetDlgItemText(IDC_VERSION, str); / fill disk information char szWindowsPath_MAX_PATH; GetWindowsDirectory(szWindowsPath, _MAX_PAT

    24、H); ULARGE_INTEGER TotalNumberOfBytes, TotalNumberOfFreeBytes; GetDiskFreeSpaceEx(LPSTR)szWindowsPath, NULL, &TotalNumberOfBytes, &TotalNumberOfFreeBytes); / total space str.Format(%lu KB, TotalNumberOfBytes.QuadPart / 1024L); SetDlgItemText(IDC_TOTAL_SPACE, str); / free space str.Format(%lu KB, Tot

    25、alNumberOfFreeBytes.QuadPart / 1024L); SetDlgItemText(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 G

    26、lobalvar.h#include BestDlg.h#ifdef _DEBUG#define 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(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)


    注意事项

    本文(五子棋程序设计报告.docx)为本站会员主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2023 冰点文库 网站版权所有

    经营许可证编号:鄂ICP备19020893号-2


    收起
    展开