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

📄 searchpos.cpp

📁 这是一个关于A*算法的实现8数码的程序源代码
💻 CPP
字号:
// searchpos.cpp : implementation file
//

#include "stdafx.h"
#include "A8.h"
#include "searchpos.h"
#include "math.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// Csearchpos dialog


Csearchpos::Csearchpos(CWnd* pParent /*=NULL*/)
	: CDialog(Csearchpos::IDD, pParent)
{
	//{{AFX_DATA_INIT(Csearchpos)
	m_openlist = 0;
	m_closelist = 0;
	//}}AFX_DATA_INIT
}


void Csearchpos::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(Csearchpos)
	DDX_Control(pDX, IDC_PROGRESS1, m_searchpos);
	DDX_Text(pDX, IDC_EDIT1, m_openlist);
	DDX_Text(pDX, IDC_EDIT2, m_closelist);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(Csearchpos, CDialog)
	//{{AFX_MSG_MAP(Csearchpos)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// Csearchpos message handlers
BOOL Csearchpos::ComputePos( int nodes, int openlist, int closelist)
{
	int valpos = (int)(nodes/100);
	m_openlist = openlist;
	m_closelist = closelist;
	UpdateData(false);
	UpdateWindow();
    
	switch(valpos) 
	{
	case 0: m_searchpos.SetPos(10);
		break;
	case 1: m_searchpos.SetPos(20);
		break;
	case 2: m_searchpos.SetPos(30);
		break;
    case 3: m_searchpos.SetPos(40);
		break;
    case 4: m_searchpos.SetPos(50);
		break;
    case 5: m_searchpos.SetPos(60);
		break;
    case 6: m_searchpos.SetPos(70);
		break;
    case 7: m_searchpos.SetPos(80);
		break;
    case 8: m_searchpos.SetPos(90);
		break;
    case 9: m_searchpos.SetPos(95);
		break;
	default: m_searchpos.SetPos(100);
		break;
	}
   
	return TRUE;
	
}

BOOL Csearchpos::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	m_searchpos.SetRange(0,100);
	m_searchpos.SetPos(0);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}


⌨️ 快捷键说明

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