home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 11 Learning / 04 Mommersteeg / Tennis / Predictor.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-09-23  |  1.7 KB  |  43 lines

  1. //----------------------------------------------------------------------------------------------
  2. // Sequential Prediction Demo: The positioning pattern
  3. // 
  4. // Author:  Fri Mommersteeg
  5. // Date:    10-09-2001
  6. // File:    Predictor.h
  7. //----------------------------------------------------------------------------------------------
  8.  
  9. //----------------------------------------------------------------------------------------------
  10. //    The building block for a predictor is CPredictor. It offers three abstract methods that 
  11. //    should be overriden by derived classes:
  12. //
  13. //    virtual void Update(int NextElement);    
  14. //    Call this method to update the predictor with the next element of the sequence. 
  15. //    
  16. //    virtual bool Prediction(int &Prediction);
  17. //    Call this method to get a reasonable successor for the sequence. If the return value is
  18. //    false, the prediction is bad and should not be used.
  19. //
  20. //    virtual void Reset();
  21. //    Call this method to reset the predictor (i.e. lose its memory)
  22. //----------------------------------------------------------------------------------------------
  23.  
  24. #ifndef __PREDICTOR_H
  25. #define __PREDICTOR_H
  26.  
  27. //----------------------------------------------------------------------------------------------
  28. // CPredictor: A predictor tries to predict the next element in a series of numbers (abstract)
  29. //----------------------------------------------------------------------------------------------
  30.  
  31. class CPredictor {
  32. public:
  33.     // abstract interface methods
  34.     virtual void    Update(int NextElement) = 0;
  35.     virtual bool    GetPrediction(int &Prediction) = 0;
  36.     virtual void    Reset() = 0;
  37. };
  38.  
  39. //----------------------------------------------------------------------------------------------
  40. #endif // __PREDICTOR_H
  41.  
  42.  
  43.