pub fn handler(mech: impl MechInstruments) -> Vec<MechCommand> {

     if let Some(RegisterValue::Text(friendly_id)) = mech.register_get(EBX) {
          if let Some(scan) = mech.last_radar_scan() {
               if let Some(friendly) = radar_ping_for_id(scan, friendly_id.to_string()) {
                    if friendly.distance > 2 {
                         stay_with_friendly(&mech, &friendly)
                    } else {
                         supporting_fire(&mech, friendly)
                    }
               } else {
                    locate_friendly(&mech)
               }
          } else {
               vec![
                    mech.request_radar()
               ]
          }
     } else {
          locate_friendly(&mech)
     }
}
/*
 * Strategy:
 * find friendly mech store it in EBX register to keep track (locate_friendly) otherwise move around to find it
 * if distance >= 4, move twice towards it
 * Otherwise, fire primary at any mech in range (not in the same direction as the friendly)
 */
find friendly mech store it in EBX register to keep track (locate_friendly) otherwise move around to find it
if distance >= 4, move twice towards it
Otherwise, fire primary at any mech in range (not in the same direction as the friendly)
find friendly mech store it in EBX register to keep track ( locate_friendly ) otherwise move around to find it if distance > = 4 move twice towards it Otherwise fire primary at any mech in range ( not in the same direction as the friendly )
pub fn handler(mech: impl MechInstruments) -> Vec<MechCommand> {
     if let Some(RegisterValue::Text(friendly_id)) = mech.register_get(EBX) {
          if let Some(scan) = mech.last_radar_scan() {
               if let Some(friendly) = radar_ping_for_id(scan, friendly_id.to_string()) {
                    if friendly.distance > 2 {
                         stay_with_friendly(&mech, &friendly)
                    } else {
                         supporting_fire(&mech, friendly)
                    }
               } else {
                    locate_friendly(&mech)
               }
          } else {
               vec![
                    mech.request_radar()
               ]
          }
     } else {
          locate_friendly(&mech)
     }
}
pub fn handler ( mech : impl MechInstruments ) -> Vec < MechCommand > { if let Some ( RegisterValue :: Text ( friendly_id ) ) = mech . register_get ( EBX ) { if let Some ( scan ) = mech . last_radar_scan ( ) { if let Some ( friendly ) = radar_ping_for_id ( scan , friendly_id . to_string ( ) ) { if friendly . distance > 2 { stay_with_friendly ( & mech , & friendly ) } else { supporting_fire ( & mech , friendly ) } } else { locate_friendly ( & mech ) } } else { vec ! [ mech request_radar ( ) ] } } else { locate_friendly ( & mech ) } }
Strategy:
 find friendly mech store it in EBX register to keep track (locate_friendly) otherwise move around to find it
 if distance >= 4, move twice towards it
 Otherwise, fire primary at any mech in range (not in the same direction as the friendly)
Strategy : find friendly mech store it in EBX register to keep track ( locate_friendly ) otherwise move around to find it if distance > = 4 move twice towards it Otherwise fire primary at any mech in range ( not in the same direction as the friendly )
mech
impl MechInstruments
mech
impl MechInstruments