Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Formations.h

Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2000,2001, Jelle Kok, University of Amsterdam
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without 
00006 modification, are permitted provided that the following conditions are met:
00007 
00008 1. Redistributions of source code must retain the above copyright notice, this 
00009 list of conditions and the following disclaimer. 
00010 
00011 2. Redistributions in binary form must reproduce the above copyright notice, 
00012 this list of conditions and the following disclaimer in the documentation 
00013 and/or other materials provided with the distribution. 
00014 
00015 3. Neither the name of the University of Amsterdam nor the names of its 
00016 contributors may be used to endorse or promote products derived from this 
00017 software without specific prior written permission. 
00018 
00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
00020 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
00021 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
00022 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 
00023 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
00024 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
00025 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
00026 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
00027 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
00028 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 */
00063 #ifndef _FORMATIONS_
00064 #define _FORMATIONS_
00065 
00066 #include "SoccerTypes.h"  // PlayerT
00067 
00068 /******************************************************************************/
00069 /********************** CLASS PLAYERTYPEINFO **********************************/
00070 /******************************************************************************/
00071 
00088 class PlayerTypeInfo
00089 {
00090   PlayerT playerType; 
00091   double  dAttrX;     
00092   double  dAttrY;     
00093   double  dMinX;      
00094   double  dMaxX;      
00095   bool    bBehindBall;
00097 public:
00098   PlayerTypeInfo( );
00099   PlayerTypeInfo( PlayerT, double, double, double, double, bool );
00100 
00101   // method to set all the values at once and displaying them all
00102   bool    setValues( PlayerT, double, double, double, double, bool );
00103   void    show     ( ostream &os = cout                            );
00104 
00105   // standard get and set methods to individually set all the values
00106   bool    setPlayerType( PlayerT type  );
00107   PlayerT getPlayerType(               ) const;
00108   bool    setAttrX     ( double  attrX );
00109   double  getAttrX     (               ) const;
00110   bool    setAttrY     ( double  attrY );
00111   double  getAttrY     (               ) const;
00112   bool    setMinX      ( double  minX  );
00113   double  getMinX      (               ) const;
00114   bool    setMaxX      ( double  maxX  );
00115   double  getMaxX      (               ) const;
00116   bool    setBehindBall( bool    b     );
00117   bool    getBehindBall(               ) const;
00118 };
00119 
00120 
00121 /******************************************************************************/
00122 /********************** CLASS FORMATIONTYPEINFO *******************************/
00123 /******************************************************************************/
00124 
00130 class FormationTypeInfo
00131 {
00132   FormationT      formationType;               
00133   VecPosition     posHome[ MAX_TEAMMATES ];    
00134   PlayerT         playerType[ MAX_TEAMMATES ]; 
00135   PlayerTypeInfo  playerTypeInfo[ MAX_PLAYER_TYPES ]; 
00137 public:
00138   FormationTypeInfo(                    );
00139   void show(         ostream &os = cout );
00140 
00141   // get and set methods to get information for a player in this formation
00142   bool            setFormationType         ( FormationT  type                 );
00143   FormationT      getFormationType         (                            ) const;
00144   bool            setPosHome               ( VecPosition pos,     int atIndex );
00145   bool            setXPosHome              ( double      x,       int atIndex );
00146   bool            setYPosHome              ( double      y,       int atIndex );
00147   VecPosition     getPosHome               ( int         atIndex        ) const;
00148   bool            setPlayerType            ( PlayerT     type,    int atIndex );
00149   PlayerT         getPlayerType            ( int         atIndex        ) const;
00150   bool            setPlayerTypeInfo        ( PlayerTypeInfo info, int atIndex );
00151   PlayerTypeInfo* getPlayerTypeInfo        ( int         atIndex              );
00152   PlayerTypeInfo* getPlayerTypeInfoOfPlayer( int         iPlayerInFormation   );
00153 };
00154 
00155 /******************************************************************************/
00156 /********************** CLASS FORMATIONS **************************************/
00157 /******************************************************************************/
00158 
00164 class Formations
00165 {
00166   FormationTypeInfo formations[ MAX_FORMATION_TYPES ]; 
00167   FormationT        curFormation;       
00168   int               iPlayerInFormation; 
00169 public:
00170   Formations( const char *strFile = NULL, FormationT ft=FT_ILLEGAL, int iNr=1);
00171   void show ( ostream &os = cout );
00172 
00173   // method to get the strategic position depending on different factors
00174   VecPosition getStrategicPosition( int         iPlayer,
00175                                     VecPosition posBall,
00176                                     double      dMaxXInPlayMode );
00177 
00178   // method to read the formations from a formation configuration file.
00179   bool        readFormations      ( const char *strFile         );
00180 
00181   // standard get and set methods for the different member variables
00182   bool        setFormation        ( FormationT formation        );
00183   FormationT  getFormation        (                             ) const;
00184   bool        setPlayerInFormation( int number                  );
00185   int         getPlayerInFormation(                             ) const;
00186   PlayerT     getPlayerType       (                             ) const;
00187 };
00188 
00189 #endif

Generated on Thu Mar 7 00:37:42 2002 for UvA Trilearn 2001 by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001