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

📄 simplepredictor.h

📁 AI Game Programming Wisdom一书的源码
💻 H
字号:
//----------------------------------------------------------------------------------------------
// Sequential Prediction Demo: The positioning pattern
// 
// Author:  Fri Mommersteeg
// Date:    10-09-2001
// File:    SimplePredictor.h
//----------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------
//	A simple O(N^2) string-matching predictor (where N is the size of the window)
//----------------------------------------------------------------------------------------------

#ifndef __SIMPLEPREDICTOR_H
#define __SIMPLEPREDICTOR_H

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

#include "predictor.h"
#include "slidingwindow.h"

//----------------------------------------------------------------------------------------------
// CSimplePredictor: predicts the next element in a sequence using string-matching prediction
//----------------------------------------------------------------------------------------------

class CSimplePredictor : public CPredictor {
public:
	CSimplePredictor() { MinPerformance = 1; }

	// implementation of interface CPredictor
	virtual void			Update(int NextElement)	 { window.Add(NextElement); }
	virtual bool			GetPrediction(int &Prediction);
	virtual void			Reset() { window.SetSize(WindowSize); }

	// configuration methods
	void					Setup(int nWindowSize, int nMinPerformance);

protected:

	CSlidingWindow <int>	window;
	int						WindowSize;
	int						MinPerformance;

};

//----------------------------------------------------------------------------------------------
#endif //__SIMPLEPREDICTOR_H

⌨️ 快捷键说明

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