📄 eight_code2dlg.h
字号:
// Eight_COde2Dlg.h : header file
//
#if !defined(AFX_EIGHT_CODE2DLG_H__4F5496B4_2FD8_459C_BA0F_4BFDA378C788__INCLUDED_)
#define AFX_EIGHT_CODE2DLG_H__4F5496B4_2FD8_459C_BA0F_4BFDA378C788__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////////////////////////////////////////////
// CEight_COde2Dlg dialog
class CEight_COde2Dlg : public CDialog
{
// Construction
public:
CEight_COde2Dlg(CWnd* pParent = NULL); // standard constructor
private:
struct Node{
int array[3][3];
int pointer;//指向父亲结点,即ab编号
int selfposition;//自己位置,以便子结点指向
int g;
int h;
int f;
};
// Dialog Data
//{{AFX_DATA(CEight_COde2Dlg)
enum { IDD = IDD_EIGHT_CODE2_DIALOG };
int m_begin_edit0;
int m_begin_edit1;
int m_begin_edit2;
int m_begin_edit3;
int m_begin_edit4;
int m_begin_edit5;
int m_begin_edit6;
int m_begin_edit7;
int m_begin_edit8;
int m_end_edit0;
int m_end_edit1;
int m_end_edit2;
int m_end_edit3;
int m_end_edit4;
int m_end_edit5;
int m_end_edit6;
int m_end_edit7;
int m_end_edit8;
int m_midd_edit0;
int m_midd_edit1;
int m_midd_edit2;
int m_midd_edit3;
int m_midd_edit4;
int m_midd_edit5;
int m_midd_edit6;
int m_midd_edit7;
int m_midd_edit8;
int m_Minute;
int m_Second;
int m_Millisecond;
int m_Nodenum;
double m_AvgNode;
int m_Step;
int m_road_len;
int m_wf;
int m_wn;
int m_pn;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CEight_COde2Dlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CEight_COde2Dlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnBegin();
afx_msg void On_Wn();
afx_msg void On_Pn();
afx_msg void OnOneStep();
afx_msg void OnInitialNode();
afx_msg void OnClearButton();
afx_msg void OnWf();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
void print_road_len();
bool checkerr(Node a);
int sigma(long x,Node &a);
bool judgement(Node &a, Node &b);
void print_AvgNode();
void print_NodeNum();
void print_runtime( );
bool compare_f(Node a,Node b);//若结点第一a的f值大于b的f值,则返回true
bool open_null();//判断open表是否为空
void copynode(Node& a,Node b);//复制b结点给a
void get_min_open(Node& a,int& positioninopen);//获得open表中f最小结点保存到a
bool compare(Node a,Node b);//比较两个结点是否相等,相等为true
int get_h_W(Node a,Node endnode);//Wm算法h值
int get_h_P(Node a,Node b);//Pn算法h值
int get_h(Node a,Node endnode,int flag);//求h值
void initializestate();
bool searchinopen(Node a,int& position_nodearray);//查找a是否在open表中,若在则将open表的值保存于pos_open_node中
bool searchinclose(Node a,int& position_nodearray,int& pos_close);//查找a是否在close表中,若在则将close中结点在nodearray中的坐标保存于pos_close_node中,将close坐标保存在pos_close中
void handle(Node a);//处理open生成的结点a
void expend(Node a,Node endnode);//扩展结点a,注意指针
void deal_with();
void print_state(int positioninnode);
void saveroad(int posinnode);
private:
//int maxlen 3000;
int flag;
int close[10000];
int open[10000];
int roadlen;
int closelen;
int openlen;
int len;
int positioninopen;
int onestep[1000];
int step_num;
Node endnode;
SYSTEMTIME star; //记录开始时间
SYSTEMTIME finish; //记录结束时间
Node nodearray[10000];
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EIGHT_CODE2DLG_H__4F5496B4_2FD8_459C_BA0F_4BFDA378C788__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -