randompredictor.h

来自「AI Game Programming Wisdom一书的源码」· C头文件 代码 · 共 45 行

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

//----------------------------------------------------------------------------------------------
//	The random predictor is just a random number generator for a specified domain.
//	It uses the standard C function rand() to generate a pseudo random number.
//----------------------------------------------------------------------------------------------

#ifndef __RANDOMPREDICTOR_H
#define __RANDOMPREDICTOR_H

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

#include "predictor.h"

//----------------------------------------------------------------------------------------------
// CRandomPredictor: Randomly predicts the next element in the sequence
//----------------------------------------------------------------------------------------------

class CRandomPredictor : public CPredictor {
public:

	// implementation of interface CPredictor
	virtual void	Update(int NextElement) { /* just ignore updates */ }
	virtual bool	GetPrediction(int &Prediction);
	virtual void	Reset() { /* just ignore resets */ }

	// setup method
	virtual void	Setup(int nAlphabetSize, unsigned int nSeed = 0);

protected:
	unsigned int	m_nAlphabetSize;

};

//----------------------------------------------------------------------------------------------
#endif // __RANDOMPREDICTOR_H

⌨️ 快捷键说明

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