// BWChessDlg.cpp : implementation file
//
#include "stdafx.h"
#include <math.h>
#include <mmsystem.h>
#include "BWChess.h"
#include "SetupDlg.h"
#include "AboutDlg.h"
#include "HowToDlg.h"
#include "Globalvar0.h"
#include "HelperAPI.h"
#include "BWChessDlg.h"
#include "RecorDdlg.h"
#include "BestDlg.h"
#include <time.h>
#include "SettingDlg.h"
#include "Demo.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//#define EDITION 17
#define PASSEDTIME 1
BOOL PlaySounds(UINT IDSoundRes, WORD wFlag = SND_ASYNC);
static TCHAR pSettings[]=_T("Settings");
/////////////////////////////////////////////////////////////////////////////
// CBWChessDlg dialog
BOOL PlaySounds(UINT IDSoundRes, WORD wFlag)
{
if (g_bSoundOn)
if (PlaySound(MAKEINTRESOURCE(IDSoundRes),
AfxGetInstanceHandle(),
wFlag|SND_RESOURCE|SND_NODEFAULT))
return TRUE;
return FALSE;
}
CBWChessDlg::CBWChessDlg(CWnd* pParent /*=NULL*/)
: CDialog(IDD_BWCHESS_DIALOG, pParent)
{
//{{AFX_DATA_INIT(CBWChessDlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_pMenu = new CMenu();
m_pDibEmpty = new CDib;
m_pDibBlack = new CDib;
m_pDibWhite = new CDib;
m_pDibBGo=new CDib;
m_pDibWGo=new CDib;
m_pDibCurB=new CDib;
m_pDibCurW=new CDib;
int i,j;
for(i=0;i<2;i++)
{
for(j=0;j<NUM+2;j++)
m_pDibHFrame[i][j]=new CDib;
for(j=0;j<NUM;j++)
m_pDibVFrame[i][j]=new CDib;
}
m_PaintNum=0;
hAccelerator=::LoadAccelerators(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_ACC));
g_nCanHintTimeB=AfxGetApp()->GetProfileInt(_T("Supior Option"), _T("CanHintTimesB"), 3);
g_nCanHintTimeW=AfxGetApp()->GetProfileInt(_T("Supior Option"), _T("CanHintTimesW"), 3);
g_nStrollSpeed=AfxGetApp()->GetProfileInt(_T("Supior Option"), _T("StrollSpeed"), 2);
//
g_nStrollSpeed=abs(g_nStrollSpeed);
g_nStrollSpeed%=3;
g_nCanHintTimeB=abs(g_nCanHintTimeB);
g_nCanHintTimeB%=31;
if(g_nCanHintTimeB<3)
g_nCanHintTimeB=3;
g_nCanHintTimeW=abs(g_nCanHintTimeW);
g_nCanHintTimeW%=31;
if(g_nCanHintTimeW<3)
g_nCanHintTimeW=3;
//
g_bPrompt =AfxGetApp()->GetProfileInt(pSettings,_T("Prompt"),1);
// g_nPortNum =AfxGetApp()->GetProfileInt(pSettings, _T("PortNum"), 1228);
g_bIsFromFile =AfxGetApp()->GetProfileInt(pSettings, _T("FromFiles"), 0);
// g_strName =AfxGetApp()->GetProfileString(pSettings, _T("CurrentName"), _T("Lovely Babby"));
// g_nNetPlayMode =AfxGetApp()->GetProfileInt(pSettings, _T("NetPlayMode"), 0);
g_nMoveSpeeds =AfxGetApp()->GetProfileInt(pSettings, _T("ComputerWalkSpeed"), 2);
g_nCbSkill =AfxGetApp()->GetProfileInt(pSettings, _T("ComputerBlackSkill"), 3);
g_nCwSkill =AfxGetApp()->GetProfileInt(pSettings, _T("ComputerWhiteSkill"), 3);
g_nCSpeed =AfxGetApp()->GetProfileInt(pSettings, _T("ComputerDemoSpeed"), 2);
g_nIsNoTimeLimit=AfxGetApp()->GetProfileInt(pSettings, _T("IsNoTimeLimit"), 0);
g_nTimeLimit =AfxGetApp()->GetProfileInt(pSettings, _T("TimeLimit"), 60);
g_bShowDynamic =AfxGetApp()->GetProfileInt(pSettings, _T("ShowDynamic"), 0);
g_bPeepOften =AfxGetApp()->GetProfileInt(pSettings, _T("PeepOften"), 1);
g_bTopMost =AfxGetApp()->GetProfileInt(pSettings, _T("TopMost"), 0);
g_bSoundOn =AfxGetApp()->GetProfileInt(pSettings, _T("SoundOn"), 1);
g_bUserBlack =AfxGetApp()->GetProfileInt(pSettings, _T("UserUseBlackStone"), 1);
g_nRunMode =AfxGetApp()->GetProfileInt(pSettings, _T("Player"), MODE_WITH_COMPUTER);
g_nSkill =AfxGetApp()->GetProfileInt(pSettings, _T("Skill"), 1);
g_nTime1 =AfxGetApp()->GetProfileInt(pSettings, _T("Time1"), 0);
g_nTime2 =AfxGetApp()->GetProfileInt(pSettings, _T("Time2"), 0);
g_nTime3 =AfxGetApp()->GetProfileInt(pSettings, _T("Time3"), 0);
g_nMark1 =AfxGetApp()->GetProfileInt(pSettings, _T("Mark1"), 0);
g_nMark2 =AfxGetApp()->GetProfileInt(pSettings, _T("Mark2"), 0);
g_nMark3 =AfxGetApp()->GetProfileInt(pSettings, _T("Mark3"), 0);
g_strName1 =AfxGetApp()->GetProfileString(pSettings, _T("Name1"), _T("Anonymous"));
g_strName2 =AfxGetApp()->GetProfileString(pSettings, _T("Name2"), _T("Anonymous"));
g_strName3 =AfxGetApp()->GetProfileString(pSettings, _T("Name3"), _T("Anonymous"));
g_strSec1 =AfxGetApp()->GetProfileString(pSettings, _T("Sec1"), _T(""));
g_strSec2 =AfxGetApp()->GetProfileString(pSettings, _T("Sec2"), _T(""));
g_strSec3 =AfxGetApp()->GetProfileString(pSettings, _T("Sec3"), _T(""));
g_bMovePlace =AfxGetApp()->GetProfileInt(pSettings, _T("ComputerPlaceDynamic"), 1);
CString str;
str.LoadString (IDS_AUTHOR);
AfxGetApp()->WriteProfileString(_T("Author"), _T("Shuker"), str);
}
CBWChessDlg::~CBWChessDlg()
{
delete m_pMenu;
delete m_pDibEmpty;
delete m_pDibBlack;
delete m_pDibWhite;
delete m_pDibBGo;
delete m_pDibWGo;
delete m_pDibCurB;
delete m_pDibCurW;
int i,j;
for(i=0;i<2;i++)
{
for(j=0;j<NUM+2;j++)
delete m_pDibHFrame[i][j];
for(j=0;j<NUM;j++)
delete m_pDibVFrame[i][j];
}
AfxGetApp()->WriteProfileInt(pSettings, _T("Prompt"),g_bPrompt);
AfxGetApp()->WriteProfileInt(pSettings, _T("ComputerBlackSkill"), g_nCbSkill);
AfxGetApp()->WriteProfileInt(pSettings, _T("ComputerWhiteSkill"), g_nCwSkill);
AfxGetApp()->WriteProfileInt(pSettings, _T("ComputerDemoSpeed"), g_nCSpeed);
AfxGetApp()->WriteProfileInt(pSettings, _T("ComputerWalkSpeed"), g_nMoveSpeeds);
AfxGetApp()->WriteProfileInt(pSettings, _T("ShowDynamic"), g_bShowDynamic);
AfxGetApp()->WriteProfileInt(pSettings, _T("PeepOften"), g_bPeepOften);
AfxGetApp()->WriteProfileInt(pSettings, _T("TopMost"), g_bTopMost);
AfxGetApp()->WriteProfileInt(pSettings, _T("SoundOn"), g_bSoundOn);
AfxGetApp()->WriteProfileInt(pSettings, _T("UserUseBlackStone"), g_bUserBlack);
AfxGetApp()->WriteProfileInt(pSettings, _T("Player"), g_nRunMode);
AfxGetApp()->WriteProfileInt(pSettings, _T("Skill"), g_nSkill);
AfxGetApp()->WriteProfileInt(pSettings, _T("Time1"), g_nTime1);
AfxGetApp()->WriteProfileInt(pSettings, _T("Time2"), g_nTime2);
AfxGetApp()->WriteProfileInt(pSettings, _T("Time3"), g_nTime3);
AfxGetApp()->WriteProfileInt(pSettings, _T("Mark1"), g_nMark1);
AfxGetApp()->WriteProfileInt(pSettings, _T("Mark2"), g_nMark2);
AfxGetApp()->WriteProfileInt(pSettings, _T("Mark3"), g_nMark3);
AfxGetApp()->WriteProfileString(pSettings, _T("Name1"), g_strName1);
AfxGetApp()->WriteProfileString(pSettings, _T("Name2"), g_strName2);
AfxGetApp()->WriteProfileString(pSettings, _T("Name3"), g_strName3);
AfxGetApp()->WriteProfileString(pSettings, _T("Sec1"), g_strSec1);
AfxGetApp()->WriteProfileString(pSettings, _T("Sec2"), g_strSec2);
AfxGetApp()->WriteProfileString(pSettings, _T("Sec3"), g_strSec3);
AfxGetApp()->WriteProfileInt(pSettings, _T("ComputerPlaceDynamic"), g_bMovePlace);
AfxGetApp()->WriteProfileInt(pSettings, _T("TimeLimit"), g_nTimeLimit);
AfxGetApp()->WriteProfileInt(pSettings, _T("IsNoTimeLimit"), g_nIsNoTimeLimit);
AfxGetApp()->WriteProfileInt(_T("Supior Option"), _T("StrollSpeed"), g_nStrollSpeed);
AfxGetApp()->WriteProfileInt(_T("Supior Option"), _T("CanHintTimesB"), g_nCanHintTimeB);
AfxGetApp()->WriteProfileInt(_T("Supior Option"), _T("CanHintTimesW"), g_nCanHintTimeW);
// AfxGetApp()->WriteProfileInt(pSettings, _T("NetPlayMode"), g_nNetPlayMode);
// AfxGetApp()->WriteProfileString(pSettings, _T("CurrentName"), g_strName);
AfxGetApp()->WriteProfileInt(pSettings, _T("FromFiles"), g_bIsFromFile);
// AfxGetApp()->WriteProfileInt(pSettings, _T("PortNum"), g_nPortNum);
}
void CBWChessDlg::InitParams()
{
for (int i=0; i<NUM;i++)
for (int j=0; j<NUM; j++)
kernel[i][j] = 0;
kernel[3][3]=kernel[4][4]=2;
kernel[3][4]=kernel[4][3]=1;
m_CurPt.x = m_CurPt.y =-1;
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
本课题设计并实现了一个可以单人或双人对战的黑白棋游戏系统,该系统采用C++语言在Microsoft Visual C++ 6.0下编写代码,采用VC中比较流行的MFC模板进行编程。系统不仅使人进行双人对战也可以进行单人与计算机的对战,且人工智能比较高超。 系统主要功能包括:开始游戏,保存游戏,计算机演示,排行榜以及像悔棋与退出之类的一些功能,它们通过VC中强大的文档编译功能进行自动生成,然后通过手工增加代码和一些图片,声音等文件来进行实现。
资源推荐
资源详情
资源评论
收起资源包目录
C++黑白棋游戏完全代码 (157个子文件)
BWChess.aps 295KB
CanPlace1.bmp 3KB
CanPlace2.bmp 3KB
white.BMP 3KB
Empty.bmp 3KB
CurBlack.bmp 3KB
Black.bmp 3KB
CurWhite.bmp 3KB
Frame1-2.bmp 3KB
Frame2-10.bmp 3KB
Frame4-1.bmp 3KB
Frame10-6.bmp 3KB
Frame4-10.bmp 3KB
Frame1-8.bmp 3KB
Frame10-9.bmp 3KB
Frame8-1.bmp 3KB
Frame3-10.bmp 3KB
Frame3-1.bmp 3KB
Frame1-9.bmp 3KB
Frame10-3.bmp 3KB
Frame1-7.bmp 3KB
Frame8-10.bmp 3KB
Frame10-5.bmp 3KB
Frame7-1.bmp 3KB
Frame6-10.bmp 3KB
Frame5-1.bmp 3KB
Frame10-4.bmp 3KB
Frame7-10.bmp 3KB
Frame5-10.bmp 3KB
Frame9-1.bmp 3KB
Frame10-2.bmp 3KB
Frame9-10.bmp 3KB
Frame2-1.bmp 3KB
Frame10-7.bmp 3KB
Frame1-5.bmp 3KB
Frame1-6.bmp 3KB
Frame6-1.bmp 3KB
Frame1-3.bmp 3KB
Frame10-8.bmp 3KB
Frame1-4.bmp 3KB
Frame11.bmp 2KB
Frame10-1.bmp 2KB
Frame1-10.bmp 2KB
Frame10-10.bmp 2KB
MASK.BMP 2KB
BWChess.clw 10KB
BWChessDlg.cpp 118KB
CREDITSTATIC.CPP 28KB
Dib.cpp 23KB
BtnST.cpp 16KB
HyperLink.cpp 9KB
AboutDlg.cpp 7KB
BestDlg.cpp 5KB
Demo.cpp 5KB
HowToDlg.cpp 5KB
DigitalPlayer.cpp 5KB
SetupDlg.cpp 4KB
RecordDlg.cpp 4KB
HelperAPI.cpp 4KB
NetPlay.cpp 3KB
SettingDlg.cpp 3KB
ConfirmSec.cpp 3KB
stack.cpp 3KB
AddSec.cpp 3KB
Message2.cpp 2KB
Message1.cpp 2KB
BWChess.cpp 2KB
Undo.cpp 2KB
StdAfx.cpp 209B
HANDBLACK.CUR 326B
hand.cur 326B
HANDWHITE.CUR 326B
BWChess.dsp 12KB
BWChess.dsw 539B
BWChess.exe 652KB
resource.h 14KB
BtnST.h 6KB
BWChessDlg.h 5KB
CREDITSTATIC.H 3KB
HyperLink.h 3KB
Dib.h 3KB
BestDlg.h 2KB
HowToDlg.h 2KB
SetupDlg.h 2KB
RecordDlg.h 2KB
AboutDlg.h 2KB
SettingDlg.h 2KB
NetPlay.h 1KB
Demo.h 1KB
BWChess.h 1KB
DigitalPlayer.h 1KB
ConfirmSec.h 1KB
AddSec.h 1KB
Message2.h 1KB
Message1.h 1KB
GlobalVar.h 1KB
GlobalVar0.h 1KB
StdAfx.h 1KB
Undo.h 1001B
stack.h 972B
共 157 条
- 1
- 2
aol1238888
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页