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-2002, 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 */
00067 #ifndef _FORMATIONS_
00068 #define _FORMATIONS_
00069 
00070 #include "SoccerTypes.h"  // PlayerT
00071 
00072 /******************************************************************************/
00073 /********************** CLASS PLAYERTYPEINFO **********************************/
00074 /******************************************************************************/
00075 
00092 class PlayerTypeInfo
00093 {
00094   PlayerT playerType; 
00095   double  dAttrX;     
00096   double  dAttrY;     
00097   double  dMinX;      
00098   double  dMaxX;      
00099   bool    bBehindBall;
00101 public:
00102   PlayerTypeInfo( );
00103   PlayerTypeInfo( PlayerT, double, double, double, double, bool );
00104 
00105   // method to set all the values at once and displaying them all
00106   bool    setValues( PlayerT, double, double, double, double, bool );
00107   void    show     ( ostream &os = cout                            );
00108 
00109   // standard get and set methods to individually set all the values
00110   bool    setPlayerType( PlayerT type  );
00111   PlayerT getPlayerType(               ) const;
00112   bool    setAttrX     ( double  attrX );
00113   double  getAttrX     (               ) const;
00114   bool    setAttrY     ( double  attrY );
00115   double  getAttrY     (               ) const;
00116   bool    setMinX      ( double  minX  );
00117   double  getMinX      (               ) const;
00118   bool    setMaxX      ( double  maxX  );
00119   double  getMaxX      (               ) const;
00120   bool    setBehindBall( bool    b     );
00121   bool    getBehindBall(               ) const;
00122 };
00123 
00124 
00125 /******************************************************************************/
00126 /********************** CLASS FORMATIONTYPEINFO *******************************/
00127 /******************************************************************************/
00128 
00134 class FormationTypeInfo
00135 {
00136   FormationT      formationType;               
00137   VecPosition     posHome[ MAX_TEAMMATES ];    
00138   PlayerT         playerType[ MAX_TEAMMATES ]; 
00139   PlayerTypeInfo  playerTypeInfo[ MAX_PLAYER_TYPES ]; 
00141 public:
00142   FormationTypeInfo(                    );
00143   void show(         ostream &os = cout );
00144 
00145   // get and set methods to get information for a player in this formation
00146   bool            setFormationType         ( FormationT  type                 );
00147   FormationT      getFormationType         (                            ) const;
00148   bool            setPosHome               ( VecPosition pos,     int atIndex );
00149   bool            setXPosHome              ( double      x,       int atIndex );
00150   bool            setYPosHome              ( double      y,       int atIndex );
00151   VecPosition     getPosHome               ( int         atIndex        ) const;
00152   bool            setPlayerType            ( PlayerT     type,    int atIndex );
00153   PlayerT         getPlayerType            ( int         atIndex        ) const;
00154   bool            setPlayerTypeInfo        ( PlayerTypeInfo info, int atIndex );
00155   PlayerTypeInfo* getPlayerTypeInfo        ( int         atIndex              );
00156   PlayerTypeInfo* getPlayerTypeInfoOfPlayer( int         iPlayerInFormation   );
00157 };
00158 
00159 /******************************************************************************/
00160 /********************** CLASS FORMATIONS **************************************/
00161 /******************************************************************************/
00162 
00168 class Formations
00169 {
00170   FormationTypeInfo formations[ MAX_FORMATION_TYPES ]; 
00171   FormationT        curFormation;       
00172   int               iPlayerInFormation; 
00173 public:
00174   Formations( const char *strFile = NULL, FormationT ft=FT_ILLEGAL, int iNr=1);
00175   void show ( ostream &os = cout );
00176 
00177   // method to get the strategic position depending on different factors
00178   VecPosition getStrategicPosition( int         iPlayer,
00179                                     VecPosition posBall,
00180                                     double      dMaxXInPlayMode );
00181 
00182   // method to read the formations from a formation configuration file.
00183   bool        readFormations      ( const char *strFile         );
00184 
00185   // standard get and set methods for the different member variables
00186   bool        setFormation        ( FormationT formation        );
00187   FormationT  getFormation        (                             ) const;
00188   bool        setPlayerInFormation( int number                  );
00189   int         getPlayerInFormation(                             ) const;
00190   PlayerT     getPlayerType       ( int iIndex = -1             ) const;
00191 };
00192 
00193 #endif

Generated on Tue Jul 2 10:18:51 2002 for UvA Trilearn 2002 by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001