#side Teledont
This is teledont updated for the last rule changes.  It has shorter range weapons(30).
An larger energy gathering hardware (eater, solar-cell).  Children also gravitate to
different areas of the world and it waits until it has high energy before it opens fire.
10/1  Eater and constructor increased again.
#author Matt Burkholder	
#date 24 Oct 2002
#color 55f
#type Teledont
#color a0a 
#hardware 
		processor 15 
		engine 0.175
		constructor 2.2
		energy 2000 20
		solar-cells .5
		eater 5
		robot-sensor 22 5
		food-sensor 12 3
		armor 502
		repair-rate .5
		blaster 20 23 5
		

 	
#code 

#vector dest
#vector target
#var targetDirection 0
#var HomeAngle
#var robot-sensor-now 0
#var food-sensor-now 0
#var take-a-shot 0

   position 50 < 25 75 ifev swap 50 < 25 75 ifev swap target!
			food-sensor-range 0.6 * food-sensor-focus-distance!
			do
						energy 1900 > energy constructor-remaining 1.25 * > or 
      constructor-max-rate 0 ifev constructor-rate!
						1 constructor-type!
						armor max-armor < energy 20 > and max-repair-rate 0 ifev repair-rate!
      time robot-sensor-now > if
         fire-robot-sensor sync
         robot-found take-a-shot energy 1800 > robot-distance 15 < or or and if
             robot-position position v- 
											  robot-velocity velocity v- 
											  robot-distance blaster-speed / vs* v+ 
										  	rect-to-polar targetDirection! drop
             robot-direction take-a-shot - abs 0.5 > take-a-shot and
             0 robot-direction ifev take-a-shot!
             time 15 + robot-sensor-now! 
             robot-distance robot-mass 5 / 10 max blaster-range 3 - min < if 
               3 robot-direction pi + polar-to-rect position v+ dest! 
             then
         else
             0 targetDirection!
             time 50 + robot-sensor-now!
             0 take-a-shot!
         then
      then

      targetDirection 0 = Blaster-Cooldown or nif
         targetDirection fire-blaster then

						time food-sensor-now > if
        target position v- angle food-sensor-focus-direction!
								fire-food-sensor sync
								food-found if
										18000 food-sensor-now!
										 food-position 2dup seek-location sync sync sync sync
								else 
											time 50 + food-sensor-now!  
           speed nif
              20 target position v- norm 35 > 
              food-sensor-focus-direction random-angle ifev
              polar-to-rect position v+  else dest then
        then
								dest!
						then 
					
					dest seek-location 

	    speed eaten or nif
       time food-sensor-now! then
					;speed energy 499 > or nif
						;energy sync energy - constructor-rate - -1 > if
					;			time 50 + food-sensor-now min food-sensor-now! 
					;then then
			forever
	
#end 

