#  If the state is tanksoar and the sound sensor is not silent or there is a tank on radar or there is an 
#  incoming missile, and health is low or the energy is low, then propose the retreat operator.

sp {propose*retreat*sound
   (state <s> ^name tanksoar
              ^missiles-energy low
              ^io.input-link.sound {<direction> <> silent})
   -->
   (<s> ^operator <o> + =)
   (<o> ^name retreat)}

sp {propose*retreat*radar
   (state <s> ^name tanksoar
              ^missiles-energy low
              ^io.input-link.radar.tank)
   -->
   (<s> ^operator <o> + =)
   (<o> ^name retreat)}

sp {propose*retreat*incoming
   (state <s> ^name tanksoar
              ^missiles-energy low
              ^io.input-link.incoming.<dir> yes)
   -->
   (<s> ^operator <o> + =)
   (<o> ^name retreat)}

#  If the state is tanksoar and the tanks is under attack but cannot not directly sense the other tank, then 
#  propose the retreat operator.

sp {propose*retreat*incoming*not-sensed
   (state <s> ^name tanksoar
  ^io.input-link <io>)
         (<io> ^incoming.<dir> yes
              -^radar.tank
               ^sound silent)
   -->
   (<s> ^operator <o> + =)
   (<o> ^name retreat)}
