player_type_analyzer.h

説明を見る。
00001 // -*-c++-*-
00002 
00008 /*
00009  *Copyright:
00010 
00011  Copyright (C) Hidehisa AKIYAMA
00012 
00013  This code is free software; you can redistribute it and/or
00014  modify it under the terms of the GNU Lesser General Public
00015  License as published by the Free Software Foundation; either
00016  version 2.1 of the License, or (at your option) any later version.
00017 
00018  This library is distributed in the hope that it will be useful,
00019  but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00021  Lesser General Public License for more details.
00022 
00023  You should have received a copy of the GNU Lesser General Public
00024  License along with this library; if not, write to the Free Software
00025  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026 
00027  *EndCopyright:
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

librcscに対してThu May 1 15:41:20 2008に生成されました。  doxygen 1.5.0