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

PlayerSettings.cpp

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 #include "PlayerSettings.h"
00050 
00051 /*****************************************************************************/
00052 /********************* CLASS PlayerSettings **********************************/
00053 /*****************************************************************************/
00054 
00058 PlayerSettings::PlayerSettings( ) : GenericValues("PlayerSettings", 27)
00059 {
00060   dPlayerConfThr         = 0.88; // threshold below player info is illegal
00061   dPlayerHighConfThr     = 0.92; // threshold above which player info is high
00062   dBallConfThr           = 0.90; // threshold below which ball info is illegal
00063   dPlayerDistTolerance   = 7.5;  // distance when unknownplayer is mapped
00064   dPlayerWhenToTurnAngle = 7.0;  // angle when to turn when moving
00065   dPlayerWhenToKick      = 0.85; // % of kick power rate when kick is performed
00066   iPlayerWhenToIntercept = 30;   // maximum number of interception cycles
00067   dClearBallDist         = 5.0;  // dist before penalty area to clear ball to
00068   dClearBallOppMaxDist   = 30.0; // radius in which opp in clear ball has to be
00069   dClearBallToSideAngle  = 17.0; // minimum angle for clear ball to side
00070   dConeWidth             = 0.5;  // cone width to check for opponents in pass
00071   dPassEndSpeed          = 1.2;  // end speed for ball when passed to teammate
00072   dFastPassEndSpeed      = 1.8;  // end speed for ball when passed fast
00073   dPassExtraX            = 0.0;  // extra x value added to player passing pos
00074   dFractionWaitNoSee     = 0.61;  // % of cycle to wait in cycle with no see
00075   dFractionWaitSeeBegin  = 0.70; // % to wait in cycle with see in begin
00076   dFractionWaitSeeEnd    = 0.85; // % to wait in cycle with see in 2nd  half
00077   dMarkDistance          = 5.0;  // mark distance to a player
00078   dStratAreaRadius       = 5.0;  // radius around strat pos to find optimal pos
00079   dShootRiskProbability  = 0.88; // prob. of scoring when shooting with risk
00080   iCyclesCatchWait       = 20;   // cycles to wait after a catch
00081   iServerTimeOut         = 9;    // seconds before server is assumed dead
00082   dDribbleAngThr         = 20.0; // angle thr. to turn to ball before dribbling
00083   dTurnWithBallAngThr    = 45.0; // angle threshold to kick ball
00084   dTurnWithBallFreezeThr = 0.2;  // ball speed threshold to freeze ball
00085   iInitialFormation      = 2;    // initial formation number
00086   dMaxYPercentage        = 0.8;  // max y in strat. pos (percentage of field)
00087 
00088   // add all the settings and link text string to variable
00089   addSetting( "player_conf_thr"     , &dPlayerConfThr,  GENERIC_VALUE_DOUBLE );
00090   addSetting( "player_high_conf_thr", &dPlayerHighConfThr,
00091                                                         GENERIC_VALUE_DOUBLE );
00092   addSetting( "ball_conf_thr"      ,  &dBallConfThr,    GENERIC_VALUE_DOUBLE );
00093   addSetting( "player_dist_tolerance",&dPlayerDistTolerance,
00094                                                         GENERIC_VALUE_DOUBLE );
00095   addSetting( "player_when_to_turn",  &dPlayerWhenToTurnAngle,
00096                                                         GENERIC_VALUE_DOUBLE );
00097   addSetting( "player_when_to_kick", &dPlayerWhenToKick,GENERIC_VALUE_DOUBLE );
00098   addSetting( "player_when_to_intercept",&iPlayerWhenToIntercept,
00099                                                         GENERIC_VALUE_INTEGER);
00100   addSetting( "clear_ball_dist"    ,  &dClearBallDist,  GENERIC_VALUE_DOUBLE );
00101   addSetting( "clear_ball_opp_max_dist", &dClearBallOppMaxDist,
00102                                                         GENERIC_VALUE_DOUBLE );
00103   addSetting( "clear_ball_side_angle", &dClearBallToSideAngle,
00104                                                         GENERIC_VALUE_DOUBLE );
00105   addSetting( "cone_width"         ,  &dConeWidth,      GENERIC_VALUE_DOUBLE );
00106   addSetting( "pass_end_speed"     ,  &dPassEndSpeed,   GENERIC_VALUE_DOUBLE );
00107   addSetting( "fast_pass_end_speed", &dFastPassEndSpeed,GENERIC_VALUE_DOUBLE );
00108   addSetting( "pass_extra_x"       ,  &dPassExtraX,     GENERIC_VALUE_DOUBLE );
00109   addSetting( "wait_no_see"        ,&dFractionWaitNoSee,GENERIC_VALUE_DOUBLE );
00110   addSetting( "wait_see_begin" , &dFractionWaitSeeBegin,GENERIC_VALUE_DOUBLE );
00111   addSetting( "wait_see_end"    , &dFractionWaitSeeEnd, GENERIC_VALUE_DOUBLE );
00112   addSetting( "mark_distance"      ,  &dMarkDistance,   GENERIC_VALUE_DOUBLE );
00113   addSetting( "strat_area_radius"  ,  &dStratAreaRadius,GENERIC_VALUE_DOUBLE );
00114   addSetting( "shoot_risk_prob", &dShootRiskProbability,GENERIC_VALUE_DOUBLE );
00115   addSetting( "cycles_catch_wait"  ,  &iCyclesCatchWait,GENERIC_VALUE_INTEGER);
00116   addSetting( "server_time_out"    ,  &iServerTimeOut,  GENERIC_VALUE_INTEGER);
00117   addSetting( "dribble_ang_thr"    ,  &dDribbleAngThr,  GENERIC_VALUE_DOUBLE );
00118   addSetting( "turn_with_ball_ang_thr" , &dTurnWithBallAngThr,
00119                                                         GENERIC_VALUE_DOUBLE );
00120   addSetting( "turn_with_ball_freeze_thr" , &dTurnWithBallFreezeThr,
00121                                                         GENERIC_VALUE_DOUBLE );
00122   addSetting( "initial_formation"  , &iInitialFormation,GENERIC_VALUE_INTEGER);
00123   addSetting( "max_y_percentage"   , &dMaxYPercentage,  GENERIC_VALUE_DOUBLE );
00124 
00125 }
00126 
00130 double PlayerSettings::getPlayerConfThr( ) const
00131 {
00132   return dPlayerConfThr;
00133 }
00134 
00139 bool PlayerSettings::setPlayerConfThr( double d )
00140 {
00141   dPlayerConfThr = d;
00142   return true;
00143 }
00144 
00148 double PlayerSettings::getPlayerHighConfThr( ) const
00149 {
00150   return dPlayerHighConfThr;
00151 }
00152 
00157 bool PlayerSettings::setPlayerHighConfThr( double d )
00158 {
00159   dPlayerHighConfThr = d;
00160   return true;
00161 }
00162 
00166 double PlayerSettings::getBallConfThr( ) const
00167 {
00168   return dBallConfThr;
00169 }
00170 
00175 bool PlayerSettings::setBallConfThr( double d )
00176 {
00177   dBallConfThr = d;
00178   return true;
00179 }
00180 
00184 double PlayerSettings::getPlayerDistTolerance( ) const
00185 {
00186   return dPlayerDistTolerance;
00187 }
00188 
00193 bool PlayerSettings::setPlayerDistTolerance( double d )
00194 {
00195   dPlayerDistTolerance = d;
00196   return true;
00197 }
00198 
00202 double PlayerSettings::getPlayerWhenToTurnAngle( ) const
00203 {
00204   return dPlayerWhenToTurnAngle;
00205 }
00206 
00211 bool PlayerSettings::setPlayerWhenToTurnAngle( double d )
00212 {
00213   dPlayerWhenToTurnAngle = d;
00214   return true;
00215 }
00216 
00225 double PlayerSettings::getPlayerWhenToKick( ) const
00226 {
00227   return dPlayerWhenToKick;
00228 }
00229 
00235 bool PlayerSettings::setPlayerWhenToKick( double d )
00236 {
00237   dPlayerWhenToKick = d;
00238   return true;
00239 }
00240 
00245 int PlayerSettings::getPlayerWhenToIntercept( ) const
00246 {
00247   return iPlayerWhenToIntercept;
00248 }
00249 
00254 bool PlayerSettings::setPlayerWhenToIntercept( int i )
00255 {
00256   iPlayerWhenToIntercept = i;
00257   return true;
00258 }
00259 
00265 double PlayerSettings::getClearBallDist( ) const
00266 {
00267   return dClearBallDist;
00268 }
00269 
00270 
00274 bool PlayerSettings::setClearBallDist( double d )
00275 {
00276   dClearBallDist = d;
00277   return true;
00278 }
00279 
00283 double PlayerSettings::getClearBallOppMaxDist( ) const
00284 {
00285   return dClearBallOppMaxDist;
00286 }
00287 
00292 bool PlayerSettings::setClearBallOppMaxDist( double d )
00293 {
00294   dClearBallOppMaxDist = d;
00295   return true;
00296 }
00297 
00300 double PlayerSettings::getClearBallToSideAngle( ) const
00301 {
00302   return dClearBallToSideAngle;
00303 }
00304 
00308 bool PlayerSettings::setClearBallToSideAngle( double d )
00309 {
00310   dClearBallToSideAngle = d;
00311   return true;
00312 }
00313 
00320 double PlayerSettings::getConeWidth( ) const
00321 {
00322   return dConeWidth;
00323 }
00324 
00331 bool PlayerSettings::setConeWidth( double d )
00332 {
00333   dConeWidth = d;
00334   return true;
00335 }
00336 
00340 double PlayerSettings::getPassEndSpeed( ) const
00341 {
00342   return dPassEndSpeed;
00343 }
00344 
00349 bool PlayerSettings::setPassEndSpeed( double d )
00350 {
00351   dPassEndSpeed = d;
00352   return true;
00353 }
00354 
00358 double PlayerSettings::getFastPassEndSpeed( ) const
00359 {
00360   return dFastPassEndSpeed;
00361 }
00362 
00363 
00368 bool PlayerSettings::setFastPassEndSpeed( double d )
00369 {
00370   dFastPassEndSpeed = d;
00371   return true;
00372 }
00373 
00377 double PlayerSettings::getPassExtraX( ) const
00378 {
00379   return dPassExtraX;
00380 }
00381 
00386 bool PlayerSettings::setPassExtraX( double d )
00387 {
00388   dPassExtraX = d;
00389   return true;
00390 }
00391 
00396 double PlayerSettings::getFractionWaitNoSee( ) const
00397 {
00398   return dFractionWaitNoSee;
00399 }
00400 
00407 bool PlayerSettings::setFractionWaitNoSee( double d )
00408 {
00409   dFractionWaitNoSee = d;
00410   return true;
00411 }
00412 
00418 double PlayerSettings::getFractionWaitSeeBegin( ) const
00419 {
00420   return dFractionWaitSeeBegin;
00421 }
00422 
00429 bool PlayerSettings::setFractionWaitSeeBegin( double d )
00430 {
00431   dFractionWaitSeeBegin = d;
00432   return true;
00433 }
00434 
00440 double PlayerSettings::getFractionWaitSeeEnd( ) const
00441 {
00442   return dFractionWaitSeeEnd;
00443 }
00444 
00451 bool PlayerSettings::setFractionWaitSeeEnd( double d )
00452 {
00453   dFractionWaitSeeEnd = d;
00454   return true;
00455 }
00456 
00460 double PlayerSettings::getMarkDistance( ) const
00461 {
00462   return dMarkDistance;
00463 }
00464 
00469 bool PlayerSettings::setMarkDistance( double d )
00470 {
00471   dMarkDistance = d;
00472   return true;
00473 }
00474 
00479 double PlayerSettings::getStratAreaRadius( ) const
00480 {
00481   return dStratAreaRadius;
00482 }
00483 
00489 bool PlayerSettings::setStratAreaRadius( double d )
00490 {
00491   dStratAreaRadius = d;
00492   return true;
00493 }
00494 
00501 double PlayerSettings::getShootRiskProbability( ) const
00502 {
00503   return dShootRiskProbability;
00504 }
00505 
00506 
00514 bool PlayerSettings::setShootRiskProbability( double d )
00515 {
00516   dShootRiskProbability = d;
00517   return true;
00518 }
00519 
00523 int PlayerSettings::getCyclesCatchWait( ) const
00524 {
00525   return iCyclesCatchWait;
00526 }
00527 
00532 bool PlayerSettings::setCyclesCatchWait( int i )
00533 {
00534   iCyclesCatchWait = i;
00535   return true;
00536 }
00537 
00543 int PlayerSettings::getServerTimeOut( ) const
00544 {
00545   return iServerTimeOut;
00546 }
00547 
00553 bool PlayerSettings::setServerTimeOut( int i )
00554 {
00555   iServerTimeOut = i;
00556   return true;
00557 }
00558 
00563 double PlayerSettings::getDribbleAngThr( ) const
00564 {
00565   return dDribbleAngThr;
00566 }
00567 
00573 bool PlayerSettings::setDribbleAngThr( double d )
00574 {
00575   dDribbleAngThr = d;
00576   return true;
00577 }
00578 
00579 
00585 double PlayerSettings::getTurnWithBallAngThr( ) const
00586 {
00587   return dTurnWithBallAngThr;
00588 }
00589 
00596 bool PlayerSettings::setTurnWithBallAngThr( double d )
00597 {
00598   dTurnWithBallAngThr = d;
00599   return true;
00600 }
00601 
00606 double PlayerSettings::getTurnWithBallFreezeThr( ) const
00607 {
00608   return dTurnWithBallFreezeThr;
00609 }
00610 
00616 bool PlayerSettings::setTurnWithBallFreezeThr( double d )
00617 {
00618   dTurnWithBallFreezeThr = d;
00619   return true;
00620 }
00621 
00624 int PlayerSettings::getInitialFormation( ) const
00625 {
00626   return iInitialFormation;
00627 }
00628 
00632 bool PlayerSettings::setInitialFormation( int i )
00633 {
00634   iInitialFormation = i;
00635   return true;
00636 }
00637 
00642 double PlayerSettings::getMaxYPercentage( ) const
00643 {
00644   return dMaxYPercentage;
00645 }
00646 
00652 bool PlayerSettings::setMaxYPercentage( double d )
00653 {
00654   dMaxYPercentage = d;
00655   return true;
00656 }

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