predictor.h

来自「C人工智能游戏开发的一些实例源代码 C Game development in 」· C头文件 代码 · 共 43 行

H
43
字号
//----------------------------------------------------------------------------------------------
// Sequential Prediction Demo: The positioning pattern
// 
// Author:  Fri Mommersteeg
// Date:    10-09-2001
// File:    Predictor.h
//----------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------
//	The building block for a predictor is CPredictor. It offers three abstract methods that 
//	should be overriden by derived classes:
//
//	virtual void Update(int NextElement);	
//	Call this method to update the predictor with the next element of the sequence. 
//	
//	virtual bool Prediction(int &Prediction);
//	Call this method to get a reasonable successor for the sequence. If the return value is
//	false, the prediction is bad and should not be used.
//
//	virtual void Reset();
//	Call this method to reset the predictor (i.e. lose its memory)
//----------------------------------------------------------------------------------------------

#ifndef __PREDICTOR_H
#define __PREDICTOR_H

//----------------------------------------------------------------------------------------------
// CPredictor: A predictor tries to predict the next element in a series of numbers (abstract)
//----------------------------------------------------------------------------------------------

class CPredictor {
public:
	// abstract interface methods
	virtual void	Update(int NextElement) = 0;
	virtual bool	GetPrediction(int &Prediction) = 0;
	virtual void	Reset() = 0;
};

//----------------------------------------------------------------------------------------------
#endif // __PREDICTOR_H


⌨️ 快捷键说明

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