#side Rat without shields #author Warren #date 4 March 2002 A modified version of Rat without shields. Designed to reveal how much Rat's success depends on shields. #color 873 #type Rat #color 810 #hardware energy 300 50 ; c 100 food-sensor 12 25 ;c 29 engine .05 ;c 50 processor 10 ;c 30 solar-cells 0.01 ;c 18 armor 300 ;cost 1.0/armor eater 1.5 ;c 90 constructor 1.1 ;c 132 repair-rate .3 ;c 120 robot-sensor 8 1 grenades 10 7 5 ;c 240 #code ;; steering code ;; #var dest-x #var dest-y #var destination? 0 #var next-robot-sense -1 set-destination: ; x y -- dest-y! dest-x! 1 destination?! return ;;; main ;;; #start do food-sensor-cooldown not seek& ifc energy constructor-remaining 250 min > if ;reproduce if lots of energy available or if ;we expect to live long enough to give birth and have enough energy to do so 1 constructor-type! constructor-max-rate constructor-rate! else 0 constructor-rate! then energy 20 > if ;;don't defend if too low on energy time next-robot-sense > if 0 0 fire-robot-sensor sync time 5 + next-robot-sense! then robot-found grenades-cooldown not and energy 150 > and if robot-position robot-velocity velocity v- robot-distance grenades-speed / vs* v+ position v- rect-to-polar fire-grenade then energy armor 50 min > max-armor 1 - armor > and if max-repair-rate repair-rate! else 0 repair-rate! then else 0 repair-rate! then destination? if dest-x dest-y seek-location then ;else is handled by seek reutine forever seek: food-found if ;hack so that at birth we spread out 0 0 fire-food-sensor else food-sensor-range random-angle fire-food-sensor then sync food-found if food-position set-destination else ;wander, at reduced power. 0 destination?! engine-max-power 0.5 * engine-power! 0.1 speed if velocity angle else random-angle then polar-to-rect set-velocity then return #end