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

📄 eludeobstacleview.h

📁 用C++开发的一个人工神经网络小游戏
💻 H
字号:
// EludeObstacleView.h : interface of the CEludeObstacleView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_ELUDEOBSTACLEVIEW_H__FE5AB83D_D51F_45E6_827C_2DC66AA0F73C__INCLUDED_)
#define AFX_ELUDEOBSTACLEVIEW_H__FE5AB83D_D51F_45E6_827C_2DC66AA0F73C__INCLUDED_

#include "GenAlg.h"	// Added by ClassView
#include "Aerocraft.h"	// Added by ClassView
#include "WGenAlg.h"
#include "NeuralNet.h"
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "SVector2D.h"

#include "EludeObstacleDoc.h"
#include "FileHandle.h"	// Added by ClassView
#include "DlgChangeParameter.h"	// Added by ClassView
#include "PropSheet.h"	// Added by ClassView
#include "Prop1.h"

//using namespace std;

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

// Attributes
public:
	CEludeObstacleDoc* GetDocument();

// Operations
public:

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

// Implementation
public:
	void TrainTheNetwork();
	void DrawStar(CDC *pDC);
	void EnableMenuItem(UINT uID,bool boEnable);
	inline double CalculateFitness();
	int ThinkItStepByStep(vector<SGenome> &population);
	SGenome m_ControlGen;
	int m_end;
	CGenAlg GenAlg;
	CWGenAlg WGenAlg;
	CNeuralNet NeuralNet;
	int ifCollide();
	void showTheObstacle(CDC* pDC);
	CAerocraft Aerocraft;
	virtual ~CEludeObstacleView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CEludeObstacleView)
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnDemo();
	afx_msg void OnPlayerControl();
	afx_msg void OnStartGenAlg();
	afx_msg void OnStartStepGenAlg();
	afx_msg void OnSetObstacle();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnCancelMode();
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnCaptureChanged(CWnd *pWnd);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	afx_msg void OnSaveMap();
	afx_msg void OnSaveMap1();
	afx_msg void OnSaveMap2();
	afx_msg void OnSaveMap3();
	afx_msg void OnSaveMap4();
	afx_msg void OnSaveMap5();
	afx_msg void OnDefaultMap1();
	afx_msg void OnDefaultMap2();
	afx_msg void OnDefaultMap3();
	afx_msg void OnSetParameter();
	afx_msg void OnTrainNetwork();
	afx_msg void OnDemoNetwork();
	afx_msg void OnDefaultMap4();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

private:
	CProp1 m_prop1;
	CProp2 m_prop2;
	double CalculateFitnessForANN();
	int ifPointOut;
	void showTheWGenAlgData();
	int m_ShortStar[10];
	void DrawArrowhead(CDC *pDC,int category);
	double m_distanceX[10];
	double m_distanceY[10];
	void showTheAerocraft(CDC *pDC);
	void updateAerocraftDC();
	CDC Mem;
	void updateObstacleDC();
	CDC ObstacleDC;
	CDC AerocraftDC;
	CDlgChangeParameter m_DlgChangeParameter;
	int m_ControlStepByStep;
	int ifStepByStep;
	void showTheGenAlgData();
	CFileHandle FileHandle;
	int ifPressLButton;
	int m_centerY;
	int m_centerX;
	int m_setMode;
	double m_theShortestDistance;
	int ifPress;
	void OnInitialUpdate();
};

#ifndef _DEBUG  // debug version in EludeObstacleView.cpp
inline CEludeObstacleDoc* CEludeObstacleView::GetDocument()
   { return (CEludeObstacleDoc*)m_pDocument; }
#endif

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

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

#endif // !defined(AFX_ELUDEOBSTACLEVIEW_H__FE5AB83D_D51F_45E6_827C_2DC66AA0F73C__INCLUDED_)

⌨️ 快捷键说明

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