#side Revenge Garden #author Devon Garden with Commune's Revenge. #color cd0 #seed 2 1 1 1 3 1 1 1 (20030329) Now seeds with a Revenge. (20040110) Fixed for (old) syphon renaming and redistancing. Channel 5 is targets for Revenges. #type Crop (20030104) Smaller. #color 0f0 #hardware armor 40 solar-cells .3 energy 300 0 ;; That's all. No brain even. #type Gardener (20030104) Larger weight on distance. Cost reduction. Gestate earlier. (20030329) Gestate later, to save energy for Revenges. Build Revenges even when short on crops. Build slightly more crops. Don't give away all our energy when feeding. Call for help when damaged. #color c30 #hardware energy 200 5 syphon 4 constructor 2 robot-sensor 7 10 radio send processor 10 engine .04 armor 60 solar-cells .01 #code #vector target #var score #var best-score #var feeding #var last-armor construct: energy 150 constructor-remaining 20 + min > constructor-max-rate 0 ifev constructor-rate! return check-armor: armor last-armor < if position 2 5 send armor last-armor! then return #start 0 robot-sensor-sees-enemies! 1 robot-sensor-sees-friends! armor last-armor! do constructor-type nif 3 type-population 7 * population < if 3 else 1 type-population 2 type-population 6 * < 1 2 ifev then constructor-type! then construct check-armor fire-robot-sensor sync pick^ best-score 0 > if seek^ feeding feed& suck& ifec 0 syphon-rate! else construct check-armor sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync then forever pick: 0 best-score! do energy 100 > if robot-type 3 = and-if robot-velocity or not and-if energy 250 robot-energy - min robot-distance 10 * - score! score best-score > if robot-position target! score best-score! 1 feeding! then else robot-type 1 = if robot-energy robot-distance 40 * - score! score best-score > if robot-position target! score best-score! 0 feeding! then then then construct check-armor next-robot while-loop return seek: ;syphon-max-rate syphon-rate! target position v- angle syphon-direction! radius .5 + syphon-distance! do target position target v- unitize v+ seek-location construct check-armor target position 1 radius + in-range until-loop 0 engine-power! return feed: syphon-max-rate negate syphon-rate! target position v- rect-to-polar syphon-direction! syphon-distance! do construct check-armor energy 20 < stop-feeding& ifg syphoned syphon-max-rate negate > until-loop stop-feeding: 0 syphon-rate! return suck: syphon-max-rate syphon-rate! target position v- rect-to-polar syphon-direction! syphon-distance! do construct check-armor syphoned syphon-max-rate < until-loop 0 syphon-rate! return #type Revenge Yet another reuse of Commune's Revenge. #color 000 #decoration c00 dot (20030102) Better combat movement. Renamed call-for-help to call-for-food. More frequent calls. Better choice of whether to fight. Less frequent scans, to save energy. Now checks channel 5 after a failed chase. (20030105) Reduced unnecessary blaster range. Now using seek-moving-location. go-home no longer uses random target near home. (20030110) Adapted for Revenge Garden. Try not to run out of energy away from home. #hardware engine .1 energy 250 10 repair-rate .04 armor 400 blaster 25 1 10 robot-sensor 8 shot-sensor 7 processor 13 radio send receive #code #vector home #vector target #var next-call #vector callpos autorepair: energy 100 > max-repair-rate 0 ifev repair-rate! return #start position home! idle& jump hungry: 0 engine-power! 0 repair-rate! do sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync energy 120 < while-loop 5 clear-messages idle: 0 engine-power! do autorepair time robot-sensor-time 30 + >= if fire-robot-sensor sync robot-found fight& ifg then time shot-sensor-time 12 + >= if fire-shot-sensor sync shot-found chase-shot& ifg then 5 messages if energy armor min 150 > and-if 5 receive drop target! chase& jump then sync energy 70 > while-loop hungry& jump chase-shot: shot-position shot-velocity unitize -20 vs* v+ target! target 2 5 send chase: do energy armor min 70 < retreat& ifg target seek-location autorepair time robot-sensor-time 20 + >= if fire-robot-sensor sync robot-found fight& ifg then time shot-sensor-time 12 + >= if fire-shot-sensor sync shot-found chase-shot& ifg then target position 2 in-range until-loop 5 messages 1 - 5 clear-messages 5 receive go-home& nifg target! chase& jump fight: robot-position 2 5 send engine-max-power engine-power! do robot-position robot-velocity seek-moving-location autorepair time robot-sensor-time blaster-reload-time + >= if fire-robot-sensor sync robot-found go-home& nifg robot-distance .8 robot-radius + < if robot-direction fire-blaster then then energy armor min 30 > while-loop retreat& jump retreat: 5 clear-messages do energy 2 < hungry& ifg home seek-location autorepair home position 7 in-range until-loop idle& jump go-home: 5 clear-messages do energy 40 < retreat& ifg home seek-location autorepair time robot-sensor-time 25 + >= if fire-robot-sensor sync robot-found fight& ifg then time shot-sensor-time 12 + >= if fire-shot-sensor sync shot-found chase-shot& ifg then 5 messages if energy armor min 100 > and-if 5 receive drop target! chase& jump then home position 8 in-range until-loop idle& jump #end