#side Excommunicate #author Devon December 20-21 2003 Commune without a colony. Sustenance now does gestation; there is no Pregnant. Neither type tries to return home. (Revenges should maybe return to friendly territory.) #color ccc #seed 2 1 (20030102) Merged channels 3 and 4. Channel 2 contains places with lots of food. Channel 3 contains positions and energies of hungry cells. Channel 5 contains targets (sometimes imaginary). #type Revenge #color c00 (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. (20030418) Bigger repairer, smaller blaster. Go-home uses reduced engine power to save energy. (20031220-21) Now homeless: no go-home; retreat runs away from enemies. #hardware engine .1 energy 250 10 repair-rate .1 armor 400 blaster 22 1 10 robot-sensor 8 shot-sensor 7 processor 13 radio send receive #code #vector target #var next-call #vector callpos autorepair: energy 100 > max-repair-rate 0 ifev repair-rate! return call-for-food: speed ifr time next-call < position callpos radius in-range and ifr position energy 3 3 send time 200 + next-call! position callpos! return hungry: 0 engine-power! 0 repair-rate! call-for-food do sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync call-for-food energy 120 < while-loop 5 clear-messages idle: 5 clear-messages 0 engine-power! #start 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 energy 220 < call-for-food& ifc sync energy 70 > while-loop hungry& jump chase-shot: shot-position shot-velocity unitize -20 vs* v+ target! target 2 5 send chase: do 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 energy armor min 70 < if retreat& jump then target position 2 in-range until-loop 5 messages 1 - 5 clear-messages 5 receive idle& nifg target! chase& jump fight: robot-position 2 5 send do robot-position robot-velocity seek-moving-location autorepair time robot-sensor-time blaster-reload-time + >= if fire-robot-sensor sync robot-found idle& nifg robot-distance .8 robot-radius + < if robot-direction fire-blaster then then energy armor min 30 > while-loop retreat& jump retreat: position target v- unitize 15 vs* position v+ swap 0 max world-width min swap 0 max world-height min target! do target seek-location autorepair target position 3 in-range until-loop idle& jump #type Sustenance #color 0c0 Skittish gatherer (although it came here by a strange route). Feeds any nearby hungry cells; otherwise gestates. (20021129) Now wanders when no food seen. (20021201) Now turns syphon on before reaching destination, for accidental feeding. Now turns off shield when out of energy. (20030102) Now prefers closer and hungrier cells. (20030105) Now announce food-position-overall instead of own position. (20030329) Call for food when starving. (20030428) More energy storage. (20030627) More initial energy, to avoid embarrassing early starvation. (20030721) Fixed for syphon renaming and re-aiming. Removed useless shield. (20031220-21) Now gestates instead of returning home. Now flees from shots, not injury. (The shot-sensor in Commune 1-9 wasn't used!) Longer-range syphon. #hardware syphon 1.5 2 energy 500 25 constructor 1.5 eater 2 engine .04 armor 150 repair-rate .05 food-sensor 10 shot-sensor 8 processor 10 radio receive send #code #vector dest ;location #vector food-save #var last-food-announce #var next-call #vector callpos autorepair: armor energy < max-repair-rate 0 ifev repair-rate! return construct: ;modified from Escherichia constructor-type if energy 480 constructor-remaining 15 + min >= constructor-max-rate 0 ifev constructor-rate! else energy 480 > if 1 type-population 2 type-population < 1 2 ifev constructor-type! constructor-max-rate constructor-rate! then then return ;;variables for determining who to feed #var cur-energy #var best-energy #vector cur-pos ;dest is best-pos eat: 0 syphon-rate! #start fire-food-sensor sync do autorepair construct food-found if food-position seek-location food-found food-energy 100 - * 1000 > if time last-food-announce 150 + >= and-if food-position-overall 2 2 send time last-food-announce! then else food-save and if food-save position 5 in-range not and-if food-save seek-location else 2 messages if 2 messages 1 - 2 skip-messages 2 receive drop food-save! food-save seek-location else 0 world-width random 0 world-height random food-save! then then energy 5 < hungry& ifg then eaten nif time food-sensor-time food-found 50 150 ifev + > and-if fire-food-sensor sync then time shot-sensor-time 13 + >= if fire-shot-sensor sync shot-found run& ifg then 3 messages if energy eaten 490 250 ifev > and-if infinity best-energy! 3 receive drop do cur-energy! cur-pos! cur-energy cur-pos position dist 10 * + cur-energy! cur-energy best-energy < if cur-energy best-energy! cur-pos dest! then dest seek-location 3 receive while-loop best-energy 300 < feed& ifg then forever hungry: 0 engine-power! 0 syphon-rate! 0 repair-rate! 0 constructor-rate! position callpos! do speed nif time next-call < position callpos radius in-range nand and-if position energy 3 3 send time 250 + next-call! position callpos! then sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync sync energy 25 < while-loop eat& jump run: ;modified from Escherichia 0 syphon-rate! shot-position shot-velocity unitize 5 vs* v- 2 5 send ;call for help shot-velocity unitize position shot-position v- unitize v+ 15 vs* position v+ swap 0 max world-width min swap 0 max world-height min dest! do dest seek-location autorepair construct position dest 4 in-range until-loop eat& jump feed: food-found if food-position else 0 0 then food-save! syphon-max-rate negate syphon-rate! do position dest v- unitize syphon-range vs* dest v+ seek-location dest position 2.5 in-range if dest position v- rect-to-polar syphon-direction! syphon-distance! sync syphoned -1 > eat& ifg else 0.5 radius + syphon-distance! dest position v- angle syphon-direction! then time shot-sensor-time 13 + >= if fire-shot-sensor sync shot-found run& ifg then autorepair construct energy 25 > while-loop eat& jump #end