⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 othelloview.cpp

📁 搜索算法部分使用minmax递归
💻 CPP
📖 第 1 页 / 共 2 页
字号:

void COthelloView::OnUpdateGameFirst(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if(pDoc->m_Judge->m_Model == H2A)
		pCmdUI->SetCheck(1);
	else
		pCmdUI->SetCheck(0);
}

void COthelloView::OnUpdateGameSecond(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if(pDoc->m_Judge->m_Model == A2H)
		pCmdUI->SetCheck(1);
	else
		pCmdUI->SetCheck(0);
	
}

void COthelloView::OnFunctionHint() 
{
	// TODO: Add your command handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pDoc->m_Judge->m_Hint = !(pDoc->m_Judge->m_Hint);
	if(pDoc->m_Judge->m_Hint)
		PlaySound( (LPCSTR)IDR_HINT,AfxGetApp()->m_hInstance,SND_RESOURCE | SND_ASYNC);
	Invalidate(0);
}

void COthelloView::OnUpdateFunctionHint(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pCmdUI->SetCheck(pDoc->m_Judge->m_Hint);
}

void COthelloView::OnFunctionRedo() 
{
	// TODO: Add your command handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pDoc->m_Judge->Redo();	
}

void COthelloView::OnFunctionUndo() 
{
	// TODO: Add your command handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pDoc->m_Judge->Undo();	
}


void COthelloView::OnFunctionDepth9() 
{
	// TODO: Add your command handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pDoc->m_Judge->m_Depth = 9;
	
}

void COthelloView::OnUpdateFunctionDepth9(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if(pDoc->m_Judge->m_Depth==9)
		pCmdUI->SetCheck(1);
	else
		pCmdUI->SetCheck(0);
}


void COthelloView::OnFunctionDepth8() 
{
	// TODO: Add your command handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pDoc->m_Judge->m_Depth = 8;
	
}

void COthelloView::OnUpdateFunctionDepth8(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if(pDoc->m_Judge->m_Depth==8)
		pCmdUI->SetCheck(1);
	else
		pCmdUI->SetCheck(0);	
}

void COthelloView::OnFunctionDepth7() 
{
	// TODO: Add your command handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pDoc->m_Judge->m_Depth = 7;
	
}

void COthelloView::OnUpdateFunctionDepth7(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if(pDoc->m_Judge->m_Depth==7)
		pCmdUI->SetCheck(1);
	else
		pCmdUI->SetCheck(0);	
}

void COthelloView::OnFunctionDepth6() 
{
	// TODO: Add your command handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pDoc->m_Judge->m_Depth = 6;
	
}

void COthelloView::OnUpdateFunctionDepth6(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if(pDoc->m_Judge->m_Depth==6)
		pCmdUI->SetCheck(1);
	else
		pCmdUI->SetCheck(0);	
}

void COthelloView::OnFunctionDepth5() 
{
	// TODO: Add your command handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pDoc->m_Judge->m_Depth = 5;
	
}

void COthelloView::OnUpdateFunctionDepth5(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if(pDoc->m_Judge->m_Depth==5)
		pCmdUI->SetCheck(1);
	else
		pCmdUI->SetCheck(0);	
}

void COthelloView::OnFunctionDepth4() 
{
	// TODO: Add your command handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pDoc->m_Judge->m_Depth = 4;
	
}

void COthelloView::OnUpdateFunctionDepth4(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if(pDoc->m_Judge->m_Depth==4)
		pCmdUI->SetCheck(1);
	else
		pCmdUI->SetCheck(0);	
}

void COthelloView::OnFunctionDepth3() 
{
	// TODO: Add your command handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pDoc->m_Judge->m_Depth = 3;
	
}

void COthelloView::OnUpdateFunctionDepth3(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if(pDoc->m_Judge->m_Depth==3)
		pCmdUI->SetCheck(1);
	else
		pCmdUI->SetCheck(0);	
}

void COthelloView::OnFunctionDepth2() 
{
	// TODO: Add your command handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pDoc->m_Judge->m_Depth = 2;
	
}

void COthelloView::OnUpdateFunctionDepth2(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if(pDoc->m_Judge->m_Depth==2)
		pCmdUI->SetCheck(1);
	else
		pCmdUI->SetCheck(0);	
}

void COthelloView::OnFunctionDepth1() 
{
	// TODO: Add your command handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pDoc->m_Judge->m_Depth = 1;
	
}

void COthelloView::OnUpdateFunctionDepth1(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if(pDoc->m_Judge->m_Depth==1)
		pCmdUI->SetCheck(1);
	else
		pCmdUI->SetCheck(0);	
}

void COthelloView::OnFunctionStable() 
{
	// TODO: Add your command handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pDoc->m_Judge->m_EvaluateType = 1;	
}

void COthelloView::OnUpdateFunctionStable(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if(pDoc->m_Judge->m_EvaluateType==1)
		pCmdUI->SetCheck();
	else
		pCmdUI->SetCheck(0);
}

void COthelloView::OnFunctionAction() 
{
	// TODO: Add your command handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pDoc->m_Judge->m_EvaluateType = 2;	
}

void COthelloView::OnUpdateFunctionAction(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if(pDoc->m_Judge->m_EvaluateType==2)
		pCmdUI->SetCheck();
	else
		pCmdUI->SetCheck(0);
}

void COthelloView::OnHelpHelp() 
{
	// TODO: Add your command handler code here
	CString name = "./日月棋^-^.chm";
	ShellExecuteA(*(AfxGetApp()->m_pMainWnd),"open",name,NULL,NULL,SW_SHOW);
}

void COthelloView::OnFunctionMusic() 
{
	// TODO: Add your command handler code here
	m_Music = !m_Music;
	if(m_Music) {
		MCI_PLAY_PARMS mciPlay;
		mciPlay.dwFrom = 0;
		mciSendCommand(mciOpen.wDeviceID,MCI_PLAY,MCI_NOTIFY | MCI_FROM,
			(DWORD)&mciPlay);
		SetTimer(3,180350,NULL);
	}
	else {
		KillTimer(3);
		mciSendCommand(mciOpen.wDeviceID,MCI_STOP,MCI_WAIT,NULL);
	}
}

void COthelloView::OnUpdateFunctionMusic(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	if(m_Music)
		pCmdUI->SetCheck();
	else
		pCmdUI->SetCheck(0);
}

void COthelloView::OnGameDisplay() 
{
	// TODO: Add your command handler code here
	COthelloDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if(	pDoc->m_Judge->m_Gameover) {
		pDoc->m_Judge->Repeat();
		SetTimer(4,100,NULL);
		pDoc->m_Judge->Display();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -