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

Player.h

Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2000-2003, 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 */
00030 
00049 #ifndef PLAYER
00050 #define PLAYER
00051 
00052 #include "BasicPlayer.h"
00053 #include "Formations.h"     // needed for Formations
00054 
00055 #ifdef WIN32
00056   DWORD WINAPI stdin_callback( LPVOID v );
00057 #else
00058   void* stdin_callback( void * v );
00059 #endif
00060 
00061 
00064 class Player:public BasicPlayer
00065 {
00066   Formations    *formations;             
00067   bool          bContLoop;               
00069   Time          m_timeLastSay;           
00070   ObjectT       m_objMarkOpp;            
00071   ObjectT       m_objPassOption;         
00073   int           m_iPenaltyNr;            
00075   ActionT       m_actionPrev;            
00077   SoccerCommand goalieMainLoop            (                                  );
00078   SoccerCommand defenderMainLoop          (                                  );
00079   SoccerCommand midfielderMainLoop        (                                  );
00080   SoccerCommand attackerMainLoop          (                                  );
00081 
00082   void          performPenalty            (                                  );
00083 
00084 
00085   VecPosition   getDeadBallPosition       (                                  );
00086 
00087   // methods associated with saying (defined in Player.C)
00088   bool          shallISaySomething        ( SoccerCommand  soc               );
00089   bool          amIAgentToSaySomething    ( SoccerCommand  soc               );
00090   void          sayOppAttackerStatus      ( char *         str               );
00091   void          sayBallStatus             ( char *         str               );
00092   void          makeBallInfo              ( VecPosition    posBall,
00093                                             VecPosition    velBall,
00094                                             int            iDiff, 
00095                                             char *         str               );
00096 
00097 public:
00098   Player                                  ( ActHandler     *a,
00099                                             WorldModel     *wm,
00100                                             ServerSettings *ss,
00101                                             PlayerSettings *cs,
00102                                             Formations     *fs,
00103                                             char           *strTeamName,
00104                                             double         dVersion,
00105                                             int            iReconnect = -1   );
00106 
00107   void          mainLoop                  (                                  );
00108 
00109 
00110   // methods that deal with user input (from keyboard) to sent commands
00111   void          handleStdin               (                                  );
00112   void          showStringCommands        ( ostream& out                     );
00113   bool          executeStringCommand      ( char *str                        );
00114 
00115   // simple teams (PlayerTeams.cpp)
00116   SoccerCommand deMeer5                   (                                  );
00117   SoccerCommand deMeer5_goalie            (                                  );
00118 
00119 
00120 };
00121 
00122 #endif

Generated on Fri Nov 7 11:45:40 2003 for UvA Trilearn 2003 Base Code by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001