Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Representations/Perception/MSHSinglePlayerPercept.h

Go to the documentation of this file.
00001 /**
00002  * @file PlayersPercept.h
00003  * 
00004  * Declaration of class MSHSinglePlayerPercept
00005  * @author Tobias Wegner
00006  */ 
00007 
00008 #ifndef __MSHSinglePlayerPercept_h_
00009 #define __MSHSinglePlayerPercept_h_
00010 
00011 #include "PlayersPercept.h"
00012 
00013 class MSHPPF
00014 {
00015 public:
00016   static const unsigned int clear       = 0x00000000;
00017   static const unsigned int outOfField      = 0x00000001;
00018   static const unsigned int wrongSize     = 0x00000002;
00019   static const unsigned int fewTrickot      = 0x00000004; //not used
00020   static const unsigned int tooMuchWhite    = 0x00000008; //
00021   static const unsigned int tooMuchGreen    = 0x00000010;
00022   static const unsigned int tooMuchSkyBlue    = 0x00000011; //
00023   static const unsigned int tooMuchOrange   = 0x00000012; //
00024   static const unsigned int fewBrightnessChange = 0x00000014; //
00025   static const unsigned int numOfFlags      = 8;
00026 };
00027 
00028 class MSHSinglePlayerPercept : public SinglePlayerPercept
00029 {
00030 public:
00031   MSHSinglePlayerPercept () { flags = MSHPPF::clear; };
00032 
00033   /** number of scanlines hit */
00034   int lines;
00035 
00036   /** Some flags */
00037   unsigned int flags;
00038 
00039   double getValidity ()
00040   {
00041     int flagCount = 0;
00042     int flagCopy = flags;
00043 
00044     //count bits in flags
00045     for (int i = 0; i < 32; i++)
00046     {
00047       if (flagCopy & 0x00000001)
00048         flagCount++;
00049 
00050       flagCopy >>= 1;
00051     };
00052 
00053     double weight;
00054 
00055     if ((MSHPPF::numOfFlags - flagCount) != 0)
00056       weight = (MSHPPF::numOfFlags / (MSHPPF::numOfFlags - flagCount));
00057     else weight = 0;
00058 
00059     return validity * weight;
00060   };
00061 };
00062 
00063 #endif

Generated on Mon Mar 20 22:00:03 2006 for GT2005 by doxygen 1.3.6