#side Poison Ivy 4 #Author Warren #date Started June 12 2002 A three-type plant. Undefended autotrophs, parabolic shot-leaders, and force-field using anti-missilers. #color 7a0 #seed 2 3 1 #type Ivy #color 0f1 #hardware energy 10 0 armor 75 processor 1 constructor 0.501 ;c 50 solar-cells 0.5 ;c a lot #code #start do constructor-max-rate constructor-rate! constructor-type nif 1 3 random-int constructor-type! then forever #type Poison #color fa1 #hardware energy 200 0 armor 400 processor 20 constructor 0.46 solar-cells 0.5 robot-sensor 22 grenades 60 22 30 repair-rate 0.05 #code #var tti #vector accel do constructor-type nif 1 3 random-int constructor-type! then energy 150 > constructor-max-rate 0 ifev constructor-rate! energy 75 > max-repair-rate 0 ifev repair-rate! robot-sensor-time time 27 - < grenades-cooldown not and energy grenades-firing-cost > and if fire-robot-sensor sync robot-found if 0 4 random-int if robot-velocity robot-id fire-robot-sensor sync robot-found if robot-id = if robot-velocity v- vnegate ;discard large accelerations rect-to-polar swap 0.01 min swap polar-to-rect accel! else 2drop 0 0 accel! then ;robot-id = robot-distance grenades-speed / tti! accel 0.4 tti 20 min tti * * vs* robot-velocity tti vs* v+ robot-position v+ position v- rect-to-polar fire-grenade else 2drop drop then else ;try an unlead shot once in a while robot-distance robot-direction fire-grenade then ;random then ;robot-found then forever #type Anti-Missile #color fff #hardware energy 300 0 armor 400 processor 15 constructor 0.45 ;c solar-cells 0.5 ;c ~900 robot-sensor 17 force-field 0.4 17 ;c ? grenades 25 17 15 ;c ? repair-rate 0.05 #code #var incoming 0 do time robot-sensor-time 15 + > if 0 incoming! fire-robot-sensor sync robot-found if robot-velocity robot-position position v- dot robot-distance / ;stack: radial component of velocity -0.01 < if 1 incoming! then 0 incoming random not if ;always shot-lead if not missile, sometimes shot-lead if missile robot-velocity robot-distance grenades-speed / vs* else 0 0 then robot-position v+ position v- rect-to-polar fire-grenade then then incoming energy 50 > and if robot-position position v- robot-velocity time robot-sensor-time - vs* v+ rect-to-polar force-field-direction! ;stack: distance time robot-sensor-time - square 0.002 * 0.6 + + force-field-distance! force-field-max-power force-field-power! else 0 force-field-power! then constructor-type nif 1 3 random-int constructor-type! then energy robot-found 250 200 ifev > constructor-max-rate 0 ifev constructor-rate! energy 75 > max-repair-rate * repair-rate! forever #end