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

📄 randompredictor.cpp

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

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

#include "stdafx.h"
#include "randompredictor.h"

//----------------------------------------------------------------------------------------------
// Setup(): sets up the random predictor (seeds the random number generator)
//----------------------------------------------------------------------------------------------

void CRandomPredictor::Setup(int nAlphabetSize, unsigned int nSeed) {
	m_nAlphabetSize = nAlphabetSize;
	srand(nSeed);
}

//----------------------------------------------------------------------------------------------
// GetPrediction(): returns a random prediction
//----------------------------------------------------------------------------------------------

bool CRandomPredictor::GetPrediction(int &Prediction) {

	Prediction = rand() % m_nAlphabetSize;

	// always assume that the prediction is good
	return true;
}

⌨️ 快捷键说明

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