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 */ 00044 #ifndef PLAYER 00045 #define PLAYER 00046 00047 #include "BasicPlayer.h" 00048 #include "Formations.h" // needed for Formations 00049 00050 void* stdin_callback( void * v ); 00051 00054 class Player:public BasicPlayer 00055 { 00056 Formations *formations; 00057 bool bContLoop; 00059 int m_lastSay; 00061 void goalieMainLoop ( ); 00062 void defenderMainLoop ( ); 00063 void midfielderMainLoop ( ); 00064 void attackerMainLoop ( ); 00065 00066 public: 00067 Player ( ActHandler *a, 00068 WorldModel *wm, 00069 ServerSettings *ss, 00070 PlayerSettings *cs, 00071 Formations *fs, 00072 char *strTeamName, 00073 double dVersion, 00074 int iReconnect = -1 ); 00075 00076 VecPosition getStrategicPosition ( int iPlayer = -1 ); 00077 00078 // main loop and different team decision procedures 00079 void mainLoop ( ); 00080 void deMeer5 ( ); 00081 void deMeer5_goalie ( ); 00082 00083 // methods that deal with user input (from keyboard) to sent commands 00084 void handleStdin ( ); 00085 void showStringCommands ( ostream& out ); 00086 bool executeStringCommand ( char *str ); 00087 void test_only_update ( ); 00088 00089 00090 // methods associated with communication 00091 bool shallISaySomething ( ); 00092 bool amIAgentToSaySomething ( ); 00093 SoccerCommand sayWorldStatus ( ); 00094 00095 00096 } ; 00097 00098 #endif