亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? worldmodel.c

?? 機器足球2D比賽程序 對trlen_base_2002的改進
?? C
?? 第 1 頁 / 共 5 頁
字號:
/*   Copyright (c) 2000-2002, Jelle Kok, University of Amsterdam   All rights reserved.   Redistribution and use in source and binary forms, with or without    modification, are permitted provided that the following conditions are met:   1. Redistributions of source code must retain the above copyright notice, this    list of conditions and the following disclaimer.    2. Redistributions in binary form must reproduce the above copyright notice,    this list of conditions and the following disclaimer in the documentation    and/or other materials provided with the distribution.    3. Neither the name of the University of Amsterdam nor the names of its    contributors may be used to endorse or promote products derived from this    software without specific prior written permission.    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.   *//*! \file WorldModel.C  <pre>  <b>File:</b>          WorldModel.C  <b>Project:</b>       Robocup Soccer Simulation Team: UvA Trilearn  <b>Authors:</b>       Jelle Kok  <b>Created:</b>       12/02/2001  <b>Last Revision:</b> $ID$  <b>Contents:</b>      class definitions of WorldModel. This class contains  the methods of the WorldModel that process the incoming  information and analyze the current state of the world.  <hr size=2>  <h2><b>Changes</b></h2>  <b>Date</b>             <b>Author</b>          <b>Comment</b>  12/02/2001       Jelle Kok       Initial version created  </pre>  */#include<stdio.h>    // needed for printf#include<strings.h>  // needed for strcpy#include<errno.h>    // needed for ETIMEDOUT#include<pthread.h>  // needed for pthread_mutex_init#include<string.h>   // needed for strcpy#include<math.h>     // needed for erf#include"WorldModel.h"/*****************************************************************************//********************** CLASS WORLDMODEL *************************************//*****************************************************************************//*! This constructor creates the worldmodel, all variables are initialized by  default values  \param ss reference to class in which all server parameters are stored  \param ps reference to class in which all client parameters are stored   \param fs reference to class in which all formation information is stored*/	WorldModel::WorldModel( ServerSettings *ss, PlayerSettings *ps, Formations *fs):agentObject(  ){	SS                    = ss;	PS                    = ps;	formations            = fs;	bNewInfo              = false;	setSide                ( SIDE_ILLEGAL ); // is set by init message	strTeamName[0]        = '\0';	setPlayMode            ( PM_BEFORE_KICK_OFF );	iGoalDiff             = 0;	m_sidePenalty         = SIDE_ILLEGAL;	int i;	for( i = 0; i < MAX_TEAMMATES ; i ++ )		Teammates[i].setType( SoccerTypes::getTeammateObjectFromIndex( i ) );	for( i = 0; i < MAX_OPPONENTS ; i ++ )		Opponents[i].setType( SoccerTypes::getOpponentObjectFromIndex( i ) );	for( i = 0; i < MAX_OPPONENTS + MAX_TEAMMATES ; i ++ )		UnknownPlayers[i].setType( OBJECT_ILLEGAL );	for( i = 0; i < MAX_FLAGS; i ++ )		Flags[i].setType( OBJECT_ILLEGAL );	for( i = 0; i < MAX_LINES; i ++ )		Lines[i].setType( OBJECT_ILLEGAL );	iNrUnknownPlayers     = 0;	Ball.setType             ( OBJECT_BALL    );	agentObject.setType      ( OBJECT_ILLEGAL );	agentObject.setStamina   ( Stamina(SS->getStaminaMax(),1.0,1.0) );	for( i = 0 ; i < CMD_MAX_COMMANDS ; i ++ )	{		queuedCommands[i].commandType = (CommandT)i;		performedCommands[i]          = false;		iCommandCounters[i]           = 0;	}	iNrHoles              = 0;	iNrOpponentsSeen      = 0;	iNrTeammatesSeen      = 0;	bsCheckBall           = BS_ILLEGAL;	// initialize the mutex for bNewInfo	pthread_mutex_init( &mutex_newInfo, NULL );	pthread_cond_init ( &cond_newInfo, NULL );	timeLastSenseMessage = Time( 0, 1 );}/*! This method returns a pointer to the Object information of the object  type that is passed as the first argument.  \param o ObjectType of which information should be returned  \return pointer to object information of supplied ObjectT argument */Object* WorldModel::getObjectPtrFromType( ObjectT o ){	Object *object = NULL;	if( o == OBJECT_ILLEGAL )		return NULL;	if( SoccerTypes::isKnownPlayer( o ) )	{		if( o == agentObject.getType() )			object = &agentObject;		else if( SoccerTypes::isTeammate( o ) )			object = &Teammates[SoccerTypes::getIndex(o)];		else			object = &Opponents[SoccerTypes::getIndex(o)];	}	else if( SoccerTypes::isFlag( o ) )		object = &Flags[SoccerTypes::getIndex(o)];	else if( SoccerTypes::isLine( o ) )		object = &Lines[SoccerTypes::getIndex(o)];	else if( SoccerTypes::isBall( o ) )		object = &Ball;	else if( o == OBJECT_OPPONENT_GOALIE )		return getObjectPtrFromType( getOppGoalieType() );	else if( o == OBJECT_TEAMMATE_GOALIE )		return getObjectPtrFromType( getOwnGoalieType() );	return object;}/*! This method sets the time of the last catch cycle. This information is  received by the SenseHandler when the referee has sent this message.  After a catch, the goalie is not allowed to catch the ball for  catch_ban_cycles (defined in ServerSettings).  \param iTime time the ball was catched. */void WorldModel::setTimeLastCatch( Time time ){	timeLastCatch = time;}/*! This method returns the number of cycles since the last catch.  \return cycles since last catch. */int WorldModel::getTimeSinceLastCatch(){	if( timeLastCatch.getTime() == -1 )		return 1000;	return timeLastSenseMessage - timeLastCatch;}/*! This method sets the time of the last received referee message. This  information is received by the SenseHandler.  \param iTime time the referee sent the last message. */bool WorldModel::setTimeLastRefereeMessage( Time time ){	timeLastRefMessage = time;	return true;}/*! This method returns the time of the last received referee message.  \return time of last received referee message. */Time WorldModel::getTimeLastRefereeMessage( ){	return timeLastRefMessage;}/*! This method returns the current time. In case of a player this is the  time of the last sense message, in case of the coach this is the time of  the last see_global message.  \return actual time */Time WorldModel::getCurrentTime(){	if( getPlayerNumber() == 0 )		return getTimeLastSeeGlobalMessage();	else		return getTimeLastSenseMessage();}/*! This method returns the current cycle number. In case of a player this is  the cycle of the last sense message, in case of the coach this is the cycle  of the last see_global message.  \return actual time */int WorldModel::getCurrentCycle(){	if( getPlayerNumber() == 0 )		return getTimeLastSeeGlobalMessage().getTime();	else		return getTimeLastSenseMessage().getTime();}/*! This method returns whether the time of the server stands still. This occurs  during non play-on modes (kick_in, kick_off, etc.).  \return bool indicating whether time of the server stands still. */bool WorldModel::isTimeStopped(){	return getCurrentTime().isStopped();}/*! This method returns whether the last received message was a see or not.  \return bool indicating whether the last received message was a see.*/bool WorldModel::isLastMessageSee() const{	return getTimeLastSeeMessage() == getTimeLastSenseMessage() ;}/*! This method returns the time of the last see global message.  This message can only be received by the coach.  \return time of last see_global message */Time WorldModel::getTimeLastSeeGlobalMessage( ) const{	return getTimeLastSeeMessage();}/*! This method sets the time of the last see_global message.  It also sends a condition signal to indicate that variable  bNewInfo has changed. When main thread is stopped in  waitForNewInformation, it is unblocked.  \param time see message has arrived  \return true when update was succesful */bool WorldModel::setTimeLastSeeGlobalMessage( Time time ){	return setTimeLastSeeMessage( time ); // set see message}/*! This method returns the time of the last see message  \return time of last see message */Time WorldModel::getTimeLastSeeMessage( ) const{	return timeLastSeeMessage;}/*! This method sets the time of the last see message. It also sends a condition  signal to indicate that variable bNewInfo has changed. When main  thread is stopped in waitForNewInformation, it is unblocked.  \param time see message has arrived  \return true when update was succesful */bool WorldModel::setTimeLastSeeMessage( Time time ){	timeLastSeeMessage  = time;	pthread_mutex_lock  ( &mutex_newInfo );	bNewInfo            = true;	pthread_cond_signal ( &cond_newInfo );	pthread_mutex_unlock( &mutex_newInfo );	return true;}/*! This method returns the time of the last sense message  \return time of last sense message */Time WorldModel::getTimeLastSenseMessage( ) const{	return timeLastSenseMessage ;}/*! This method sets the time of the last sense message. It also send a  condition signal to indicate that variable bNewInfo has changed.  When main thread is stopped in waitForNewInformation, it is  unblocked.  \param time sense message has arrived  \return true when update was succesful */bool WorldModel::setTimeLastSenseMessage( Time time ){	timeLastSenseMessage = time;	pthread_mutex_lock( &mutex_newInfo );	bNewInfo = true;	pthread_cond_signal( &cond_newInfo );	pthread_mutex_unlock( &mutex_newInfo );	return true;}/*! This method returns the player number of the agent. The player number is  the fixed number which is given by the server after initialization.  \return player number of this player. */int WorldModel::getPlayerNumber( ) const{	return iPlayerNumber;}/*! This method sets the player number of the agent. This value is available in  the conformation message sent by the soccerserver after the initialization.  \param i new player number of the agent.  \return bool indicating whether player number was set. */bool WorldModel::setPlayerNumber( int i ){	iPlayerNumber = i;	return true;}/*! This method returns the side of the agent. Note that  the side of the agent does not change after half time.  \return side (SIDE_LEFT or SIDE_RIGHT) for agent */SideT WorldModel::getSide( ) const{	return sideSide;}/*! This method sets the side of the agent  \param s (SIDE_LEFT or SIDE_RIGHT) for agent  \return bool indicating whether update was succesful.*/bool WorldModel::setSide( SideT s ){	sideSide = s;	return true;}/*! This method returns the teamname of the agent in this worldmodel  \return teamname for the agent in this worldmodel */const char* WorldModel::getTeamName( ) const{	return strTeamName ;}/*! This method sets the teamname of the agent. The maximum team name is  MAX_TEAM_NAME_LENGTH as defined in Soccertypes.h.  \param str teamname for the agent in this worldmodel  \return bool indicating whether update was succesful.*/bool WorldModel::setTeamName( char * str ){	strcpy( strTeamName, str );	return true;}/*! This method returns the current playmode. This playmode is passed through by  the referee.  \return current playmode (see SoccerTypes for possibilities) */PlayModeT WorldModel::getPlayMode( ) const{	return playMode ;}/*! This method sets the play mode of the agent in this worldmodel  \param pm for the agent in this worldmodel  \return bool indicating whether update was succesful.*/bool WorldModel::setPlayMode( PlayModeT pm ){	playMode = pm;	if( ( pm == PM_GOAL_KICK_LEFT  && getSide() == SIDE_LEFT  ) ||			( pm == PM_GOAL_KICK_RIGHT && getSide() == SIDE_RIGHT )    )		setTimeLastCatch( getTimeLastSenseMessage() );	return true;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产日韩欧美制服另类| 欧美性一二三区| 亚洲成人综合视频| 国产精品久久久久一区二区三区| 在线播放亚洲一区| 91国偷自产一区二区开放时间 | 国产精品理论在线观看| 欧美日韩一二三| 色婷婷久久99综合精品jk白丝 | av成人免费在线观看| 国产乱子伦视频一区二区三区| 樱桃国产成人精品视频| 中文字幕一区三区| 亚洲欧洲三级电影| 国产精品理伦片| 欧美国产精品一区| 中文字幕的久久| 国产欧美一区二区精品忘忧草| 欧美mv日韩mv国产网站| 日韩三级免费观看| 欧美r级电影在线观看| 欧美一区二区三区免费在线看| 欧美性受xxxx| 欧美一区二区三级| 精品国产乱子伦一区| 色94色欧美sute亚洲线路一久| 91久久精品一区二区三| 99精品视频在线免费观看| 色婷婷激情综合| 欧美三级韩国三级日本一级| 欧美日韩国产综合一区二区三区 | 中文字幕佐山爱一区二区免费| 久久久国际精品| 国产欧美日韩久久| 国产精品欧美精品| 亚洲欧美在线高清| 亚洲一区中文在线| 免费欧美高清视频| 成人av片在线观看| 在线免费一区三区| 欧美一区二区在线看| 欧美色大人视频| 日韩欧美黄色影院| 久久久久久**毛片大全| 国产精品第一页第二页第三页| 亚洲精品高清在线观看| 另类欧美日韩国产在线| 成人性生交大片免费看中文| av不卡一区二区三区| 欧美精品v日韩精品v韩国精品v| 日韩欧美不卡在线观看视频| 欧美激情综合网| 婷婷开心激情综合| 成人影视亚洲图片在线| 欧美日韩色综合| 国产午夜精品美女毛片视频| 一区二区三区四区在线免费观看| 日韩精品视频网站| 丁香啪啪综合成人亚洲小说| 欧美日韩精品欧美日韩精品一| 久久伊人蜜桃av一区二区| 一区二区三区鲁丝不卡| 精品一区二区三区蜜桃| 在线免费精品视频| 国产日韩在线不卡| 三级一区在线视频先锋| 另类小说色综合网站| 色88888久久久久久影院按摩| 日韩视频免费观看高清完整版在线观看 | 国产精品素人一区二区| 日韩中文字幕亚洲一区二区va在线| 国产一区二区三区免费看| 欧美亚洲一区二区三区四区| 26uuu久久天堂性欧美| 同产精品九九九| 91亚洲精品久久久蜜桃| 久久久久久久网| 六月丁香婷婷久久| 欧美高清视频www夜色资源网| 久久亚洲综合色| 日本伊人色综合网| 日本高清免费不卡视频| 国产精品久久久久一区| 国产精品一级片在线观看| 欧美日韩国产首页| 亚洲国产毛片aaaaa无费看| 成人性生交大片免费| 精品国产乱码久久久久久1区2区| 国产精品伦理在线| 国产99久久久精品| 国产日韩精品一区二区三区| 狠狠色丁香久久婷婷综| 日韩一级二级三级| 麻豆精品视频在线| 欧美一级在线观看| 日韩电影在线观看电影| 91.com视频| 日本vs亚洲vs韩国一区三区二区| 色综合中文字幕| 亚洲综合自拍偷拍| 欧洲精品一区二区三区在线观看| 17c精品麻豆一区二区免费| 99久久777色| 亚洲精品中文字幕乱码三区| 国产在线精品一区二区三区不卡| 欧美视频在线一区二区三区| 婷婷成人综合网| 欧美变态口味重另类| 奇米影视在线99精品| 精品国产1区2区3区| 亚洲成av人片一区二区| 日韩写真欧美这视频| 麻豆国产欧美一区二区三区| 精品99一区二区三区| 成人精品免费看| 亚洲精品成人悠悠色影视| 欧美色窝79yyyycom| 免费高清视频精品| 日本一区二区三区国色天香 | 国产日韩欧美一区二区三区乱码| av一区二区三区四区| 日日夜夜一区二区| 亚洲色欲色欲www在线观看| 日韩三级在线观看| 欧美日免费三级在线| 91亚洲国产成人精品一区二区三 | 国产精品久久久久久久裸模| 在线观看91精品国产麻豆| 成人精品视频一区二区三区| 日本不卡视频一二三区| 亚洲最大的成人av| 亚洲欧美激情视频在线观看一区二区三区| 欧美一区二区网站| 91蜜桃在线免费视频| 国产精品一级在线| 国产主播一区二区三区| 午夜久久福利影院| 亚洲一级电影视频| 伊人一区二区三区| 综合久久久久综合| 欧美激情自拍偷拍| 欧美国产亚洲另类动漫| 久久久一区二区三区捆绑**| 日韩片之四级片| 欧美不卡一区二区三区| 日韩欧美一区二区视频| 91精品一区二区三区在线观看| 色妞www精品视频| 93久久精品日日躁夜夜躁欧美| 国产成人一区在线| 国产精品一区在线| 成人综合日日夜夜| 97se亚洲国产综合自在线观| 成人激情动漫在线观看| 成人av免费在线| 波多野结衣亚洲一区| 成人av在线观| 91小宝寻花一区二区三区| 91丨九色porny丨蝌蚪| 97久久精品人人澡人人爽| 色诱视频网站一区| 欧美日韩色综合| 日韩欧美一级二级| 久久久五月婷婷| 中文字幕精品一区| 亚洲女同ⅹxx女同tv| 亚洲国产三级在线| 男人的天堂久久精品| 国产一区高清在线| www.激情成人| 欧美日韩国产一区二区三区地区| 6080日韩午夜伦伦午夜伦| 日韩限制级电影在线观看| 久久你懂得1024| 亚洲婷婷在线视频| 亚洲高清免费在线| 精品一区二区三区视频在线观看 | 亚洲精品美腿丝袜| 日韩av电影天堂| 国产毛片精品一区| 色综合久久66| 久久久久久久一区| 亚洲一区二区三区四区在线免费观看 | 五月婷婷综合在线| 国产美女精品一区二区三区| 97精品超碰一区二区三区| 91精品国产91久久综合桃花| 久久久天堂av| 亚洲国产欧美日韩另类综合| 国产尤物一区二区| 欧洲精品视频在线观看| 久久人人97超碰com| 亚洲成人免费看| 不卡电影一区二区三区| 欧美一区二区精品| 亚洲精品高清视频在线观看| 国产真实乱偷精品视频免| 欧美综合色免费| 中文字幕一区二区三| 久久精品国产999大香线蕉|