📄 intelligence.h
字号:
//------------------------------------------------------------------------------------------------
//-------人工智能问题的头文件 作者:申徐洲 日期:2004年5月22日 AllRightsReserve
//------------------------------------------------------------------------------------------------
#ifndef INTELLIGENCE_H
#define INTELLIGENCE_H
#pragma once
#include "IntelligenceHead.h" // 使用结构TEightNumber TPosition TLevel
#import "msado15.dll" no_namespace rename("EOF","AdoEof") rename("BOF","AdoBof")
class CIntelligence
{
public:
CIntelligence(void); // 构造函数
virtual ~CIntelligence(void); // 虚拟析构函数
public:
bool initIntelligence(CString strSource, CString strDestination); // 初始化八数码问题
bool searchByAlgorithm(void); // A*算法搜索
TInitAiPtr getInitAi(bool bSrcOrDst);
TExitAiPtr getExitAi(CString strNode);
TIntelligencePtr getResultList(void); // 获取结果链表
int getResultNum(void); // 获取结果总结点数量
int getResultDepth(void); // 获取结果深度
//void show(CDC* pDC); // 显示链表
void showTree(CTreeCtrl* pThisTree, UINT nID, UINT nID_, TIntelligencePtr pIntelligence);
void showList(CListCtrl* pThisList, CString strNode, int nWidth);
//private:
bool isValid(CString strSource, CString strDestination); // 判断源状态是否合法
bool isGoal(CString strCurrent); // 判断当前结点是不是目标状态
void newIntelligence(CString strParent); // 新建结点
CString findMinCost(void); // 找出A*算法中代价最小的结点
void findAnswer(void); // 如人工智能问题有解 找出哪些结点是正解
void generateList(void); // 产生结果链表
//private:
_ConnectionPtr m_pConnection;
_RecordsetPtr m_pRecordSet;
TIntelligencePtr m_pResult; // 人工智能问题的头指针
TInitAiPtr m_pInitAi;
TExitAiPtr m_pExitAi;
CString m_strSource; // 人工智能问题的初始状态
CString m_strDestination; // 人工智能问题的目标状态
int m_nTotalNum; // 人工智能问题的总结点数
int m_nDepth; // 人工智能问题的深度
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -