improvedpredictor.h

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

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

#ifndef __IMPROVEDPREDICTOR_H
#define __IMPROVEDPREDICTOR_H

//----------------------------------------------------------------------------------------------
// Include files
//----------------------------------------------------------------------------------------------

#include "StringMatchPredictor.h"
#include "Array.h"

//----------------------------------------------------------------------------------------------
// CImprovedPredictor: Enhances the standard string-matching predictor by taking all matching
//					   substrings into account
//
// Note: The Performance Indicator is normalized. This means that when you set up the predictor,
// the fMinPerformance parameter is a chance (between 0 and 1) that indicates the minimum
// desired probability that the prediction is correct.
//----------------------------------------------------------------------------------------------

class CImprovedPredictor : public CStringMatchPredictor {
public:
	void			Setup(int nWindowSize, int nAlphabetSize, float fMinPerformance);
	virtual void	Update(int NextElement);
	virtual bool	GetPrediction(int &Prediction);

protected:
	void			CalculatePrediction();

protected:
	CArray <float>	m_Alphabet;
	float			m_TotalPredictionValue;
	float			m_HighestPredictionValue;
	float			m_fMinPerformance;
};

//----------------------------------------------------------------------------------------------
#endif // __IMPROVEDPREDICTOR_H

⌨️ 快捷键说明

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