#side Ring of Fire #author Devon 12 November 2002 Autotrophs with blaster-using defenders that avoid friendly fire. #color f60 #type core #color 0c9 #hardware processor 2 energy 5 0 solar-cells .5 constructor .5 armor 30 #code constructor-max-rate constructor-rate! do constructor-type nif 0 2 random-int 1 max constructor-type! then forever #type ring #color 000 #hardware processor 10 radio read write robot-sensor 16 blaster 20 16 20 armor 200 repair-rate .04 engine .03 energy 100 0 solar-cells .15 #code ;mem: ;1: last-id ;2,3: home #vector post #var next-scan 0 #var dir pick-post: 1 type-population sqrt 4 + 2 type-population max ;id 1 read / 2 pi * * dir polar-to-rect 2 read 3 read v+ post! return #start 0 world-width random 0 world-height random position v- angle dir! 2 read if 2 read 3 read 5 vs* position v+ 6 vs/ else position then 3 write 2 write ;announce arrival id 1 write do pick-post post seek-location time next-scan >= if energy blaster-firing-cost > and-if fire-robot-sensor sync robot-found if robot-velocity velocity v- 2dup robot-distance blaster-speed / vs* robot-position v+ position dist blaster-speed / vs* robot-position v+ position v- angle fire-blaster time blaster-reload-time + next-scan! else time 45 + next-scan! then then energy 25 > max-repair-rate 0 ifev repair-rate! sync forever fighting: do forever #end