#side Shield + Cowards 2f
;Build ID: 108
#seed 1 3 3
#author Alexander (aka nfwu)
#type Seed
#color 000000
;#decoration 
#hardware
;;Basics:
  processor 1
  constructor 1.01
;;Energy:
  energy 25 0
  solar-cells 1
  engine .1
  armor 350
#code
#vector home
#start
position world-width 2 / world-height 2 / v-
position world-height / 0.5 > if world-height else 0 then swap
world-width / 0.5 > if world-width else 0 then swap
2 restrict-position
home!
;1 constructor-type!
do
  position home 5 in-range nif home seek-location then
  constructor-type nif
  	2 type-population 1 < if
  		2 constructor-type!
  	else
  		3 type-population 6 > if
  			3 constructor-type!
  		else
  			2 constructor-type!
  		then
  	then
  then
  3 type-population 3 < if 3 constructor-type! then
  constructor-max-rate constructor-rate!
forever

#type Constructor
#color 000000
;#decoration 
#hardware
;;Basics:
  processor 1
  constructor .61
;;Energy:
  energy 25 0
  solar-cells .6
  armor 300
#code
#vector home
#start
do
  constructor-type nif
  	0.7 random-bool if
	  		3 constructor-type!
	  	else
	  		4 constructor-type!
  	then
  	1 type-population nif 0.5 random-bool and-if 2 constructor-type! then
  then
  constructor-max-rate constructor-rate!
  3 type-population 12 < if 3 constructor-type! then
  ;1 type-population nif 6 constructor-type! then
forever

#type Defender
#decoration 000000 hline
#color FF0000
#hardware
  solar-cells .2
  engine .02
  constructor .2
  robot-sensor 15
  energy 300 0
  processor 10
  armor 150
  grenades 32 14 20
#code
#vector dest
#vector home
new-dest:
  home 8 random-angle polar-to-rect v+ 5 3 type-population 4 / + restrict-position dest!
return

#start
position world-height / 0.5 > if world-height else 0 then swap
world-width / 0.5 > if world-width else 0 then swap
home!
new-dest
do
  constructor-type nif
    0.9 random-bool if 3 else 4 then constructor-type! 
    ;0.05 random-bool if 6 constructor-type! then
  then
  1 type-population nif 2 constructor-type! emergency^ then
  autoconstruct
  20 periodic-robot-sensor drop
  robot-found if
    robot-position robot-velocity lead-grenade
  then
  dest seek-location
forever

emergency:
do
  2 constructor-type!
  home 2 restrict-position seek-location
  autoconstruct
  ;30 periodic-robot-sensor drop
  ;robot-found if
  ;  robot-position robot-velocity lead-grenade
  ;then
2 type-population 2 > until-loop
return

#type Coward
#decoration 000000 cross
#color 000000
#hardware
processor 1
armor 600
constructor .2
engine .02
solar-cells .2
energy 1 0
#code
#vector home
position world-height / 0.5 > if world-height else 0 then swap
world-width / 0.5 > if world-width else 0 then swap
4.5 restrict-position
home!
do
   home seek-location
   4 constructor-type!
   constructor-max-rate constructor-rate!
forever
#end
