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

📄 eightnumberview.h

📁 人工智能中的A*算法解决8number问题
💻 H
字号:
// EightNumberView.h : interface of the CEightNumberView class
//
/////////////////////////////////////////////////////////////////////////////
#include "XPButton.h"
#if !defined(AFX_EIGHTNUMBERVIEW_H__AAE0B438_CC35_4FD9_B916_921D3D751B76__INCLUDED_)
#define AFX_EIGHTNUMBERVIEW_H__AAE0B438_CC35_4FD9_B916_921D3D751B76__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

const int N=9;
class CEightNumberView : public CFormView
{
protected: // create from serialization only
	CEightNumberView();
	DECLARE_DYNCREATE(CEightNumberView)
protected:
	
	//UINT gamepicture[N];
    CBitmap bitmap[3][3];
    struct record
	{
         int ch[3][3];//八数码矩阵
         int si,sj;//原空格位置
         int ni,nj;//新空格位置
         int pnt;//父节点编号
         int dep;//节点深度
		 int x,y;
	}data[100001];
   // 

   int start[3][3],goal[3][3];
   int count;
   UINT Mid[3][3];
   int ni,nj;
   struct record temp,newnode,output[2000] ;
   struct record zerosite;
   int closed,open;
   int cellwidth,cellheight;
   int si,sj;//记录空格坐标
   int k;
   int depth;
   bool AutoPlay;
   bool ftot;
   //CBitmap map;
   //UINT mas;
public:
	//{{AFX_DATA(CEightNumberView)
	enum { IDD = IDD_EIGHTNUMBER_FORM };
	CXPButton	m_Explain;
	CStatic	m_ShowState;
	CXPButton	m_Start;
	CXPButton	m_OnOK;
	CXPButton	m_SepRun;
	CXPButton	m_RunToStop;
	//}}AFX_DATA

// Attributes
public:
	CEightNumberDoc* GetDocument();
    

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CEightNumberView)
	public:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void OnInitialUpdate(); // called first time after construct
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
	virtual void CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType = adjustBorder);
	//}}AFX_VIRTUAL

// Implementation
public:
	void DrawStoA();
	CString substr(CString st, int a, int b);
	
	void drawd(int x,int y,int ab);
	//void ItoBitmap();
	void GetRand();
	//void DrawStation();
	void DrawGraphics();
	void Run();
	BOOL Goals(struct record g);
	BOOL Check(int k);
	BOOL Dupe(struct record a, struct record b);
	virtual ~CEightNumberView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
public:
	CWinThread* m_pThread;
// Generated message map functions
protected:
	//{{AFX_MSG(CEightNumberView)
	afx_msg void OnPaint();
	afx_msg void OnButtonSteprun();
	afx_msg void OnButtonRun();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnCancelMode();
	afx_msg void OnButtonOnok();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnButtonStart();
	afx_msg void OnButtonExplain();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
private:
	CString String;
};

#ifndef _DEBUG  // debug version in EightNumberView.cpp
inline CEightNumberDoc* CEightNumberView::GetDocument()
   { return (CEightNumberDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_EIGHTNUMBERVIEW_H__AAE0B438_CC35_4FD9_B916_921D3D751B76__INCLUDED_)

⌨️ 快捷键说明

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