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

📄 hanoitowerview.h

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

#if !defined(AFX_HANOITOWERVIEW_H__ECC96DB3_047B_43B2_9251_F80FAA60A9A9__INCLUDED_)
#define AFX_HANOITOWERVIEW_H__ECC96DB3_047B_43B2_9251_F80FAA60A9A9__INCLUDED_

#include "Tower.h"	// Added by ClassView
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

enum TimerType {DISPLAY, MOVE};

class CHanoiTowerView : public CView
{
protected: // create from serialization only
	CHanoiTowerView();
	DECLARE_DYNCREATE(CHanoiTowerView)

// Attributes
public:
	CHanoiTowerDoc* GetDocument();

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CHanoiTowerView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL);
	protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	//}}AFX_VIRTUAL

// Implementation
public:
	CCmdUI StopCmdUI;
	bool m_bIsOpenFile;
	bool IsFinishGame();
	bool MoveAble(int oldArrowPos, int newArrowPos);
	bool m_bIsFirst;
	Tower* WhichTower(int TowerNum);
	void MoveDisc(int CapDiscNum, int SorTower, int DesTower);
	int m_nCapDiscNum;
	bool m_bIsCapDisc;
	CRect m_rectOldArrow;
	CPoint GetArrowPoint(int nArrowPos);
	
	CPoint m_pointArrow;
	
	
	int m_nIsPause;       //是否暂停自动演示
	int m_nIsReset;      //是否中止自动演示
	bool m_bTimeUp;       //是否达到定时时间

	int m_nIsStart;      //是否开始自动演示
	int m_nIsAuto;       //是否为自动演示模式
	 
	int m_nDelay;        //延时长度
	int m_nDiscNum;      //碟子数目
	int m_nArrowPos;
	CString m_strSpeed;  //与延时长度相关的字符串
	TimerType m_enumTimeDelay;
	TimerType m_enumTimeMove;

	Disc* m_pDisc;       //碟子类指针
	Tower m_TowerC;      
	Tower m_TowerB;
	Tower m_TowerA;      //三个塔  
	
	void DrawArrow(CHanoiTowerDoc *pDoc, CDC *pDC);
	void DisplayMode(CHanoiTowerDoc *pDoc, CDC *pDC);
	void DrawDisc(CHanoiTowerDoc *pDoc, CDC *pDC);
    void DrawTower(CHanoiTowerDoc *pDoc, CDC *pDC);
	virtual ~CHanoiTowerView();

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

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CHanoiTowerView)
	afx_msg void OnRunSetup();
	afx_msg void OnRunStart();
	afx_msg void OnRunReset();
	afx_msg void OnRunPause();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnUpdateRunStart(CCmdUI* pCmdUI);
	afx_msg void OnUpdateRunSetup(CCmdUI* pCmdUI);
	afx_msg void OnUpdateRunReset(CCmdUI* pCmdUI);
	afx_msg void OnUpdateRunPause(CCmdUI* pCmdUI);
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnUpdateFileSave(CCmdUI* pCmdUI);
	afx_msg void OnUpdateFileSaveAs(CCmdUI* pCmdUI);
	afx_msg void OnBarPause();
	afx_msg void OnBarReset();
	afx_msg void OnBarStart();
	afx_msg void OnBarStop();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in HanoiTowerView.cpp
inline CHanoiTowerDoc* CHanoiTowerView::GetDocument()
   { return (CHanoiTowerDoc*)m_pDocument; }
#endif

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

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

#endif // !defined(AFX_HANOITOWERVIEW_H__ECC96DB3_047B_43B2_9251_F80FAA60A9A9__INCLUDED_)

⌨️ 快捷键说明

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