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

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

?? femmebotsheterog.java

?? 一個多機器人的仿真平臺
?? JAVA
字號:
package Domains.SoccerBots.teams;/* * FemmeBotsHeteroG.java */import	EDU.gatech.cc.is.util.Vec2;import	EDU.gatech.cc.is.abstractrobot.*;import 	java.lang.Math;/* * Author: 	M. Bernardine Dias * 		Robotics Institute * 		Carnegie Mellon University * Date:	10/05/1999 * *  */public class FemmeBotsHeteroG  extends ControlSystemSS	{		private long 	curr_time; 			//What time is it?		private Vec2	me;				//Where am I in my frame?		private Vec2	ME;				//Where am I in the global frame?		private Vec2 	ball;				//Where is the ball?		private Vec2	their_goal;			//Where is their goal?		private Vec2	our_goal;			//Where is our goal?		private Vec2[]	teammates;			//Where are my teammates?		private Vec2[]	opponents;			//Where are my opponents?		private Vec2	ball_to_goal;		//How far away is the ball from their goal?		private Vec2	ball_to_home;		//How far away is the ball from our goal?		private Vec2	teammate_near_ball;	//Who is the teammate closest 									//   to the ball?		private Vec2	ball_to_team;		//A vector from the ball to the teammate closest to the ball;		private Vec2	opponent_near_ball;	//Who is the opponent closest									//   to the ball?		private Vec2	ball_to_opp;		//A vector from the ball to the opponent closest to the ball;		private Vec2	closest_to_ball;		//Who is closest to the ball?		private Vec2	just_do_it;			//What should I do?		private boolean	kick_it;			//Should I kick the ball?		private Vec2	nearest_teammate;		//Who is the teammate nearest to me?		private Vec2 	nearest_opponent;		//Who is the opponent nearest to me?					private double	set_speed;			//What speed should I move with?		private int		change;			//An int that helps interchange the angle at which the									//ball is kicked to the goal		private long	myID;				//Who am I?		private Vec2	center;			//Where is the center of the field?			/**	Configure the Avoid control system.  This method is	called once at initialization time.  You can use it	to do whatever you like.	*/	public void Configure()		{			curr_time = abstract_robot.getTime();			just_do_it = new Vec2(0,0);		}				/**	Called every timestep to allow the control system to	run.	*/	public int TakeStep()		{		/* --- First we must read our sensor outputs --- */		//We want to assess where everything is				assess_situation();		/* --- Now we can make some decisions about what to do... --- */		//First I want to figure out who I am?		//Based on that I can decide what to do...		if(myID == 3)			playCenter();		if(myID == 2)			playAttack();		if(myID == 4)			playAttack();		if(myID == 0)			playGoalKeeper();		if(myID == 1)			playDefender();		//If I am aimed at my goal don't kick the ball				if ((kick_it== false) && abstract_robot.canKick(curr_time))			just_do_it.sett(ball.t + Math.PI);		/* --- Finally we can send commands to our actuators --- */		//Set the heading		abstract_robot.setSteerHeading(curr_time, just_do_it.t);		//Set the speed		abstract_robot.setSpeed(curr_time,set_speed);		//Kick it if we can and should		if (kick_it && abstract_robot.canKick(curr_time))			abstract_robot.kick(curr_time);		//Tell the parent we're OK		return(CSSTAT_OK);		}		private void assess_situation()	{		//Get current time		curr_time = abstract_robot.getTime();		//This is just for conveniance		me = new Vec2(0,0);				//Who am I?		myID = abstract_robot.getPlayerNumber(curr_time);					//Initialize vector to where I am in global frame		ME = abstract_robot.getPosition(curr_time);				//Initialize center of the field		center = new Vec2(-ME.x,-ME.y);			//Initialize vector to the ball		ball = abstract_robot.getBall(curr_time);		//Initialize vector to opponents' goal		their_goal = abstract_robot.getOpponentsGoal(curr_time);				//Initialize vector to our goal		our_goal = abstract_robot.getOurGoal(curr_time);		//Get vectors to all my teammates		teammates = abstract_robot.getTeammates(curr_time);					//Get vectors to my opponents		opponents = abstract_robot.getOpponents(curr_time);		//Get information about who is closest to the ball		teammate_near_ball = closest_to(ball, teammates);		opponent_near_ball = closest_to(ball, opponents);				//Initialize to kick the ball straight to the goal		change = 0;		//Set my speed to a default of max speed		set_speed = 1.0;		//Figure out vectors from the players (excluding self) closest to the ball on each team		ball_to_team = new Vec2(teammate_near_ball.x, teammate_near_ball.y);		ball_to_team.sub(ball);		ball_to_opp = new Vec2(opponent_near_ball.x, opponent_near_ball.y);		ball_to_opp.sub(ball);		//Now easy to figure out who is closest to ball		Vec2 temp = new Vec2(0,0);		if(ball_to_team.r > ball_to_opp.r)		{			closest_to_ball = opponent_near_ball; 			temp.setr(ball_to_opp.r);			temp.sett(ball_to_opp.t);		}		else		{			closest_to_ball = teammate_near_ball; 			temp.setr(ball_to_team.r);			temp.sett(ball_to_team.t);		}		if(temp.r >= ball.r)		{			closest_to_ball = me; 		}		//Figure out the distance from the ball to their goal		ball_to_goal = new Vec2(their_goal.x, their_goal.y);		ball_to_goal.sub(ball);		//Figure out the distance from the ball to our goal		ball_to_home = new Vec2(our_goal.x, our_goal.y);		ball_to_home.sub(ball);		//Get information about who is closest to me		nearest_teammate = closest_to(me, teammates);		nearest_opponent = closest_to(me, opponents);		//Initialize boolean that says if we should kick or not		if(ball.x*their_goal.x >=0)			kick_it = true;		else			kick_it = false;	}	private void playDefender()	{		if(ball_to_goal.r<(2*ball_to_home.r))		{			Vec2 def_pos = new Vec2(0,0);			def_pos.setx(our_goal.x + abstract_robot.RADIUS * 3);			def_pos.sety(our_goal.y + abstract_robot.RADIUS * 2);			if (def_pos.r <abstract_robot.RADIUS* 2)				set_speed = 0;			else			{				just_do_it = def_pos;				avoidcollision();			}		}		else		{			just_do_it = Calc_block_pos();			if(ball.r <= abstract_robot.RADIUS)				just_do_it = their_goal;		}			}		private void playGoalKeeper()	//Defend the goal!	{		if( ball.x * our_goal.x > 0)		{			just_do_it.sett(ball.t);			kick_it = true;		}		else if( (Math.abs(our_goal.x) > abstract_robot.RADIUS * 1.4) ||			 (Math.abs(our_goal.y) > abstract_robot.RADIUS * 4.25) )			{				just_do_it.sett( our_goal.t);				set_speed = 1;				avoidcollision();			}		else			{				if( ball.y > 0)					just_do_it.sety(7);				else					just_do_it.sety(-7);				if(our_goal.x > 0)					just_do_it.setx(1);				else					just_do_it.setx(-1);				if( Math.abs( ball.y) < abstract_robot.RADIUS* 0.1)					set_speed = 0.0;				else		 			set_speed = 1.0;			}	}		private void playCenter()	//Stick around the center and try to score 	{		if(closest_to_ball == me)		{			if(our_goal.r < abstract_robot.RADIUS)			{				change = 0;				just_do_it = new Vec2(their_goal.x, their_goal.y+(abstract_robot.RADIUS*change));			}			else if(their_goal.r < abstract_robot.RADIUS*5)			{				just_do_it = new Vec2(their_goal.x, their_goal.y+(abstract_robot.RADIUS*change));				if(change == 0)					change = 1;				else					change = change * (-1);			}			else				just_do_it = Calc_kick_pos();		}		else if(ball_to_team.r > ball.r)		{			just_do_it = ball;		}		else		{			if (center.r <abstract_robot.RADIUS* 2)				set_speed = 0;			else			{				just_do_it = center;				avoidcollision();			}		}			}		private void playAttack()	//Try to score all the time if the ball is in their half of the field	//If the ball is on our half wait in assigned position for ball to come back to their half	{		if(closest_to_ball == me)		{			if(our_goal.r < abstract_robot.RADIUS)			{				change = 0;				just_do_it = new Vec2(their_goal.x, their_goal.y+(abstract_robot.RADIUS*change));			}			else if(their_goal.r < abstract_robot.RADIUS*5)			{				just_do_it = new Vec2(their_goal.x, their_goal.y+(abstract_robot.RADIUS*change));				if(change == 0)					change = 1;				else					change = change * (-1);			}			else				just_do_it = Calc_kick_pos();		}		else if(ball_to_goal.r <= ball_to_home.r)		{			just_do_it = Calc_kick_pos();		}		else // if ball is in our half of the field go back to pos and wait for ball		{			Vec2 my_pos = new Vec2(0,0);			if(myID == 2) // go to center-north pos			{				my_pos.setx(center.x + abstract_robot.RADIUS*3);				my_pos.sety(center.y + abstract_robot.RADIUS*3);			}			else if(myID == 4) // go to center-south pos			{				my_pos.setx(center.x + abstract_robot.RADIUS*3);				my_pos.sety(center.y - abstract_robot.RADIUS*3);			}			if (my_pos.r <abstract_robot.RADIUS* 2)				set_speed = 0;			else			{				just_do_it = my_pos;				avoidcollision();			}		}	}	private Vec2 closest_to(Vec2 ref_pt, Vec2[] contenders)	//Determines which of the contenders is closest to the reference point	{		Vec2 closest = new Vec2(0,0);		double minDist = 99999;		Vec2 pt_to_contender = new Vec2(0,0);		for(int i=0; i<contenders.length; i++)		{			pt_to_contender.setr(contenders[i].r);			pt_to_contender.sett(contenders[i].t);			pt_to_contender.sub(ref_pt);			if(pt_to_contender.r < minDist)			{				closest.sett(contenders[i].t);				closest.setr(contenders[i].r);				minDist = pt_to_contender.r;			}		}		return closest;	}	private Vec2 Calc_kick_pos()	//Calculates a good position from which the ball can be kicked	{		Vec2 kick_pos = new Vec2(ball.x, ball.y);		Vec2 off_goal = new Vec2(their_goal.x, their_goal.y+(abstract_robot.RADIUS*change));		if(change == 0)			change = 1;		else			change = change * (-1);		kick_pos.sub(off_goal);		kick_pos.setr(abstract_robot.RADIUS);		kick_pos.add(ball);		return kick_pos;	}	private Vec2 Calc_block_pos()	//Calculates a good position from which the ball can be kicked	{		Vec2 block_pos = new Vec2(ball.x, ball.y);		block_pos.add(our_goal);		block_pos.setr(block_pos.r*0.5);		return block_pos;	}	private void avoidcollision( )	{		// Try to avoid collisions		if( nearest_teammate.r < abstract_robot.RADIUS*1.5 )		{			just_do_it.setx(-nearest_teammate.x);			just_do_it.sety(-nearest_teammate.y);			just_do_it.setr(1.0);		}				else if( nearest_opponent.r < abstract_robot.RADIUS*1.5 )		{			just_do_it.setx(-nearest_opponent.x);			just_do_it.sety(-nearest_opponent.y);			just_do_it.setr(1.0);		}	}	}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
综合网在线视频| 色一区在线观看| 欧美色手机在线观看| 久久综合99re88久久爱| 亚洲成人黄色影院| 91蜜桃婷婷狠狠久久综合9色| 欧美大片一区二区三区| 一区二区三区精品视频在线| 国产精品一区免费视频| 欧美理论片在线| 亚洲欧美一区二区三区久本道91| 国产精品88888| 日韩精品一区二区三区在线| 视频一区视频二区中文| 欧美天堂一区二区三区| 亚洲天堂网中文字| 94-欧美-setu| 中文字幕一区二区日韩精品绯色| 国产成人激情av| 久久精品一区二区三区不卡 | 国产午夜亚洲精品理论片色戒| 午夜精品视频在线观看| 欧美日韩一区二区三区高清| 亚洲精品综合在线| 色老汉一区二区三区| 亚洲免费观看高清| 欧美这里有精品| 亚洲宅男天堂在线观看无病毒| 色婷婷综合在线| 亚洲综合色视频| 欧美日韩国产综合草草| 日韩国产一区二| 精品久久久网站| 日本乱码高清不卡字幕| 99re热视频这里只精品| 久久久久久一二三区| 国产一区在线不卡| 欧美国产在线观看| 成人黄色免费短视频| 中文字幕免费观看一区| 成人免费视频免费观看| 亚洲欧美日韩在线| 欧美日韩一区二区三区四区| 日韩不卡免费视频| 久久久久久久av麻豆果冻| av在线一区二区三区| 一区二区免费看| 欧美疯狂做受xxxx富婆| 久久99国产精品免费| 国产女主播一区| 91黄色免费网站| 麻豆freexxxx性91精品| 国产欧美在线观看一区| 色婷婷av一区二区三区软件| 五月婷婷色综合| 久久亚洲精精品中文字幕早川悠里| 成人黄色综合网站| 亚洲h在线观看| 国产欧美日韩麻豆91| 色琪琪一区二区三区亚洲区| 日韩专区欧美专区| 国产精品免费久久| 91精品国产综合久久久蜜臀粉嫩| 国产剧情av麻豆香蕉精品| 亚洲欧美激情插 | 欧美精品 国产精品| 美国欧美日韩国产在线播放| 国产精品青草综合久久久久99| 欧美性生活一区| 国产精品88888| 丝袜美腿亚洲综合| 亚洲丝袜精品丝袜在线| 日韩久久久久久| 在线视频一区二区免费| 激情伊人五月天久久综合| 亚洲精品高清在线观看| 久久久精品影视| 6080午夜不卡| 91老师国产黑色丝袜在线| 精品一区二区三区久久久| 亚洲国产日韩在线一区模特| 中文欧美字幕免费| 欧美刺激脚交jootjob| 日本久久电影网| 成av人片一区二区| 国产高清不卡一区| 天天免费综合色| 亚洲另类春色校园小说| 久久网这里都是精品| 欧美一区二区高清| 欧美日韩www| 欧美综合欧美视频| 91免费看片在线观看| 粉嫩欧美一区二区三区高清影视| 久久精工是国产品牌吗| 亚洲成人动漫在线观看| 亚洲日本在线天堂| 亚洲婷婷在线视频| 国产精品久久久久婷婷| 欧美国产1区2区| 国产喷白浆一区二区三区| 久久久久国产精品人| 精品久久久久久久久久久久久久久久久 | 国产欧美一区二区三区在线老狼| 日韩欧美国产电影| 欧美va在线播放| 精品国产一区二区在线观看| 欧美不卡一区二区| 日韩欧美亚洲国产另类| 日韩视频免费观看高清完整版在线观看| 欧美午夜精品久久久| 在线精品观看国产| 欧美体内she精高潮| 欧美视频在线播放| 91精品综合久久久久久| 欧美一卡在线观看| 欧美tk丨vk视频| 久久久青草青青国产亚洲免观| 久久久亚洲精华液精华液精华液| 国产欧美视频在线观看| 亚洲私人影院在线观看| 亚洲欧美偷拍卡通变态| 亚洲成人www| 激情综合五月天| 不卡视频在线看| 在线视频你懂得一区| 7878成人国产在线观看| 日韩欧美亚洲国产精品字幕久久久| 久久综合久久99| 国产精品久久久久桃色tv| 一区二区三区四区av| 蜜桃免费网站一区二区三区| 国产一区二区不卡老阿姨| 99久久精品免费看国产免费软件| 欧美性猛交一区二区三区精品| 欧美四级电影在线观看| 日韩一区二区精品在线观看| 久久久综合视频| 亚洲欧美日韩综合aⅴ视频| 婷婷综合久久一区二区三区| 国产在线国偷精品免费看| 成人高清在线视频| 欧美老人xxxx18| 欧美国产日本韩| 天堂成人国产精品一区| 国产精品一级二级三级| 欧美性xxxxxxxx| 国产午夜精品一区二区三区嫩草| 亚洲精品国久久99热| 国内成人精品2018免费看| 色久综合一二码| 久久久久国产精品麻豆| 亚洲国产精品视频| 东方aⅴ免费观看久久av| 欧美高清视频www夜色资源网| 国产精品丝袜在线| 麻豆传媒一区二区三区| 91福利视频久久久久| 久久理论电影网| 日本女人一区二区三区| 在线精品亚洲一区二区不卡| 久久综合九色综合久久久精品综合 | 风间由美一区二区av101| 欧美日本精品一区二区三区| 国产精品视频在线看| 捆绑紧缚一区二区三区视频| 91久久香蕉国产日韩欧美9色| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 美女尤物国产一区| 欧美四级电影在线观看| 中文字幕一区二区三区视频| 国内精品久久久久影院薰衣草| 欧美最猛性xxxxx直播| 国产精品区一区二区三| 国模少妇一区二区三区| 日韩精品在线看片z| 三级不卡在线观看| 在线视频你懂得一区二区三区| 国产精品伦理一区二区| 国产一区二区久久| 日韩精品一区二区在线| 日韩精品高清不卡| 欧美日韩国产中文| 午夜精品久久久久久久99樱桃| 在线视频一区二区免费| 亚洲日韩欧美一区二区在线| 成人黄色小视频在线观看| 国产精品视频yy9299一区| 国产精品综合二区| 久久夜色精品国产噜噜av| 国内精品国产三级国产a久久| 欧美不卡一区二区| 国内精品伊人久久久久av影院| 日韩欧美国产综合在线一区二区三区| 婷婷国产v国产偷v亚洲高清| 欧美精品色综合| 日本午夜一本久久久综合| 日韩免费成人网| 国产精品 欧美精品| 日本一区二区免费在线|