#Robot Name: t1000 (Terminator 2 the evil bot >:) ) #Author : Ravi Prakash #Strategy : Is best 1 only 1 enemy exists. Circles the enemy(which is currently just a point) #To do : keep scanning and update the point around which to revolve so that moves around the enemy #so that it escapes its bullets and hits the enemy using predictive firing. ang; function terminate() INCANG; #increase angle in steps of INCANG Damtorepair; #Will repair only if status is less than Damtorepair rotdir; #Direction in which to revolve around enemy (-1)->clockwise 1->anticlockwise enempx; #Position of enemy x-coordinate enempy; #Position of enemy y-coordinate enemvx; #Speed of enemy in x-direction enemvy; #Speed of enemy in y-direction dbot; #Distance of enemy bot found disttomain; #Distance at which to circle theta; #Relative angle from enemy at which I have to go count; #Repair after count loops SPEED; #Try to move to position at theta +-speed loop; tomovx; tomovy; ttheta; #Temporary theta used to resolve a collision {Damtorepair:=20; disttomain:=60; SPEED:=5; INCANG:=10; rotdir:=SPEED*1; count:=10; ang:=0; dbot:=0; while(dbot=0) do {dbot:=radar(ang); if(dbot<>0) then { enemvx:=Trsx(); enemvy:=Trsy(); enempx:=Getx(ang,dbot); enempy:=Gety(ang,dbot); fire(ang); #fire(GetAngle(enempx+enemvx,enempy+enemvy)); #distfire(GetAngle(enempx+enemvx,enempy+enemvy),dbot); } else {ang:=ang+INCANG; if(ang>360) then {INCANG:=INCANG*2/3; ang:=ang-360;}; }; }; loop:=0; while(GetNumRobots()>=1) do {if(damage()=count) then { repair(); loop:=0; } else loop:=loop+1; tomovx:=enempx+GetX(theta, disttomain)-Locx(); #enempx+disttomain*cos(theta); tomovy:=enempy+GetY(theta, disttomain)-Locy(); #enempy+disttomain*sin(theta); theta:=theta+rotdir; if(theta<0) then theta:=theta+360; if(theta>360) then theta:=theta-360; if(tomovx<240&tomovx>10&tomovy<190&tomovy>10) then goto(tomovx,tomovy); if(tomovx>240|tomovx<10|tomovy>190|tomovy<10) then {rotdir:=rotdir*(-1); ttheta:=theta+2*rotdir; tomovx:=enempx+GetX(ttheta, disttomain)-Locx(); tomovy:=enempy+GetY(ttheta, disttomain)-Locy(); if(tomovx>240|tomovx<10|tomovy>190|tomovy<10) then rotdir:=rotdir*(-1); }; }; #End of while(GetNumRobots()>=1) } begin { terminate(); } end