00001
00002
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00031
00032 #ifndef RCSC_COACH_PLAYER_TYPE_ANALYZER_H
00033 #define RCSC_COACH_PLAYER_TYPE_ANALYZER_H
00034
00035 #include <rcsc/coach/global_object.h>
00036
00037 #include <rcsc/geom/vector_2d.h>
00038 #include <rcsc/game_time.h>
00039 #include <rcsc/types.h>
00040
00041 namespace rcsc {
00042
00043 class GlobalPlayerObject;
00044 class GlobalWorldModel;
00045
00050 class PlayerTypeAnalyzer {
00051 private:
00052
00053 struct Data {
00054 bool turned_;
00055 bool maybe_referee_;
00056 bool maybe_collide_;
00057 bool maybe_kick_;
00058 Vector2D pos_;
00059 Vector2D vel_;
00060 double body_;
00061
00063 std::vector< int > invalid_flags_;
00064
00065 int type_;
00066
00067 Data();
00068 void setDefaultType();
00069 void setUnknownType();
00070 };
00071
00072 const GlobalWorldModel & M_world;
00073
00074 GameTime M_updated_time;
00075 PlayMode M_playmode;
00076
00077 GlobalBallObject M_prev_ball;
00078 Data M_teammate_data[11];
00079 Data M_opponent_data[11];
00080
00082 PlayerTypeAnalyzer();
00084 PlayerTypeAnalyzer( const PlayerTypeAnalyzer & );
00086 PlayerTypeAnalyzer & operator=( const PlayerTypeAnalyzer & );
00087 public:
00092 explicit
00093 PlayerTypeAnalyzer( const GlobalWorldModel & world );
00094
00099 const
00100 GameTime & updatedTime() const
00101 {
00102 return M_updated_time;
00103 }
00104
00109 void update();
00110
00111
00118 void reset( const int unum );
00119
00125 int heteroID( const int unum ) const
00126 {
00127 if ( unum < 1 || 11 < unum )
00128 {
00129 std::cerr << "PlayerTypeAnalyzer::heteroID() Illegal unum "
00130 << unum << std::endl;
00131 return Hetero_Unknown;
00132 }
00133 return M_opponent_data[ unum - 1 ].type_;
00134 }
00135
00136 private:
00137
00141 void updateLastData();
00142
00147 void analyze();
00148
00153 void checkTurn();
00154
00159 void checkReferee();
00160
00165 void checkCollisions();
00166
00171 void checkKick();
00172
00177 void checkPlayerDecay();
00178
00183 void checkPlayerSpeedMax();
00184
00185 };
00186
00187 }
00188
00189 #endif