#side Life and Death #author Warren Schudy #date April 30 2002 Most directly related to Homesick. Some ideas from rat and gnats. #color A07 #type Rabbitoid Mobiles: Mobile eaters. They have shields to improve survivability and to take hits for the armed types. Mobiles try and stay near their birthplace in a manner similar to the original homesick eaters. They should someday be more homesick the more damaged they are. States: -eating -wandering To be added: -running #color 00f #hardware energy 300 30 ;c 60 processor 15 ;c 45 armor 100 ;c 100 constructor 1.0 ;c 100 repair-rate 0.2 ;c 80 shot-sensor 7 ;c 10 robot-sensor 4 ;c food-sensor 10 ;c 20 engine 0.06 ;c 50 eater 2.0 ;c 300 shield 0.45 ;c 225 ;shieldPower/m/0.02 - 0.005/0.02 = 2 (halving powers) ;power = 2.25*0.02*mass = 0.045*mass #code #const Eater_type 1 #const Defender_type 2 #var home-x #var home-y construct: energy 50 < 0 constructor-max-rate ifev constructor-rate! constructor-type ifr 0 1 random 0.5 < if Eater_type constructor-type! return then Defender_Type constructor-type! return BeginEating: do defend^ construct^ food-position seek-location time food-sensor-time - 40 > if home-x home-y position v- 0.3 vs* rect-to-polar robot-sensor-focus-direction! robot-sensor-focus-distance! fire-food-sensor sync food-found nif BeginWandering& jump then then forever Defend: energy 20 < if 0 repair-rate! 0 shield! return then time shot-sensor-time - 30 > if fire-robot-sensor fire-shot-sensor sync then robot-found shot-found + 1 min max-shield * shield 0.005 - max shield! max-repair-rate repair-rate! return #start position home-y! home-x! #var last-direction-change-time -100 BeginWandering: new-wander-location^ do time last-direction-change-time 300 + > new-wander-location& ifc defend^ construct^ time food-sensor-time - 60 > if home-x home-y position v- 0.3 vs* rect-to-polar robot-sensor-focus-direction! robot-sensor-focus-distance! fire-food-sensor sync food-found if BeginEating& jump then then forever new-wander-location: 0 100 random 0 100 random seek-location time last-direction-change-time! return ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #type Devastator An attempt at an intelligent plant defender. Uses blasters, siphons and passive defense at point-blank range. Solves friendly-fire problem by being so short range there isn't room for a friend between it and target. Hardware is similar to a 500 cost rabbit, but has 1500 worth of fighting hardware added. Modes: -Eating -Killing -Wandering (ie: none of the above) #color f00 #hardware energy 500 200 ;c 250 processor 20 ;c 60 armor 250 ;c 250 constructor 0.8 ;c 80 repair-rate 0.2 ;c 100 solar-cells 0.05 ;c 90 shot-sensor 10 ;c 20 u 0.3 food-sensor 10 ;c 20 u 0.3 engine 0.18 ;c 180 eater 1.2 ;c 120 robot-sensor 20 ;c 80 u 1.2 blaster 35 2.0 10 ;c 420 syphon 1.5 ;c 150 #code #var target-x #var target-y #const Eater_type 1 #const Defender_type 2 BeginCharging: do ; 1 print-mode^ construct^ time food-sensor-time 50 + > if fire-food-sensor sync then food-position target-x target-y v- norm 1.7 < food-found and if food-position seek-location else target-x target-y position v- robot-found if robot-velocity 5 vs* v+ then 0.1 random-angle polar-to-rect v+ ;add a random 0.1 units... 0.1 vs* engine-velocity! engine-max-power engine-power! then time robot-sensor-time 10 + > if target-x target-y position v- rect-to-polar robot-sensor-focus-direction! robot-sensor-focus-distance! fire-robot-sensor sync robot-found if robot-position target-y! target-x! robot-position position v- 2dup norm dup 2.0 < if ;stack: dx dy norm syphon-distance! robot-velocity velocity v- v+ angle dup fire-blaster syphon-direction! syphon-max-rate syphon-rate! else energy 50 < BeginWandering& ifg 2drop drop 0 syphon-rate! then else ;not found... might they be dead? 0 syphon-rate! target-x target-y position v- norm robot-sensor-range < energy 100 < or if BeginEating& jump then then ;robot found then ;time to scan for robots forever ;-----below is rabbitish code #var home-x #var home-y construct: energy 200 < 0 constructor-max-rate ifev constructor-rate! constructor-type ifr 0 1 random 0.7 < if Eater_Type constructor-type! return then Defender_Type constructor-type! return BeginEating: do ; 2 print-mode^ defend^ construct^ food-position seek-location time food-sensor-time - 30 > if home-x home-y position v- 0.3 vs* rect-to-polar robot-sensor-focus-direction! robot-sensor-focus-distance! fire-food-sensor sync food-found nif BeginWandering& jump then then forever Defend: energy 50 < if 0 repair-rate! then max-repair-rate repair-rate! energy 150 < ifr ;cannot charge if low energy time robot-sensor-time - 30 > if 0 robot-sensor-focus-distance! fire-robot-sensor sync then robot-found if rdrop ;drop return address robot-position target-y! target-x! BeginCharging& jump then return #start position home-y! home-x! #var last-direction-change-time -100 BeginWandering: new-wander-location^ do ; 3 print-mode^ time last-direction-change-time 300 + > new-wander-location& ifc defend^ construct^ time food-sensor-time - 60 > if home-x home-y position v- 0.3 vs* rect-to-polar robot-sensor-focus-direction! robot-sensor-focus-distance! fire-food-sensor sync food-found if BeginEating& jump then then forever new-wander-location: 0 100 random 0 100 random seek-location time last-direction-change-time! return #var last-mode-print -100 print-mode: time last-mode-print 100 + > if print time last-mode-print! else drop then return #end