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

📄 hanoitowerdoc.h

📁 汉诺塔的实现
💻 H
字号:
// HanoiTowerDoc.h : interface of the CHanoiTowerDoc class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_HANOITOWERDOC_H__AD4B1D0A_032D_43F9_AA55_36707E05E08E__INCLUDED_)
#define AFX_HANOITOWERDOC_H__AD4B1D0A_032D_43F9_AA55_36707E05E08E__INCLUDED_

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

#include "Tower.h"
#include "Disc.h"
//#include <afxtempl.h>


class CHanoiTowerDoc : public CDocument
{
protected: // create from serialization only
	CHanoiTowerDoc();
	DECLARE_DYNCREATE(CHanoiTowerDoc)

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CHanoiTowerDoc)
	public:
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);
	//}}AFX_VIRTUAL

// Implementation
public:
	CString m_strSpeed;
	int m_nDelay;
	void DiscArrSerialize(CArchive& ar);
	void ListSerialize(CArchive& ar);
	
	
	bool m_bIsOpenFile;
	COLORREF GetColor(int nDiscNum);
	void InitializeTower();
	void InitializeDisc();
	int m_nIsFinished;
	int m_nIsStart;   //是否开始自动演示
	int m_nIsAuto;    //是否时自动演示模式
	int m_nDiscNum;   //Disc个数,默认值为5,可以有对话框获得
	
	Disc* m_pDisc;    //Disc对象指针。
	Tower m_TowerC;   //汉诺塔对象
	Tower m_TowerB;
	Tower m_TowerA;
	
	CTypedPtrList<CPtrList, CRect*> m_DiscStepList;
//	CTypedPtrList<CObList, Disc*> m_DiscStep;
	

	void move(Tower &FromTower, Tower &ToTower, Disc *pDiscArr);
	void Hanoi(int nCount, Tower &T1, Tower &T2, Tower &T3, Disc *pDiscArr);
	void AutoPlay();
	virtual ~CHanoiTowerDoc();

#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CHanoiTowerDoc)
		// NOTE - the ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

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

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

#endif // !defined(AFX_HANOITOWERDOC_H__AD4B1D0A_032D_43F9_AA55_36707E05E08E__INCLUDED_)

⌨️ 快捷键说明

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