pub fn handler(mech: impl MechInstruments) -> Vec<MechCommand> {
     if let Some(scan) = mech.last_radar_scan() {
          // Prefer to destroy previous target
          if let Some(RegisterValue::Text(enemy_id)) = mech.register_get(EBX) {
               if let Some(enemy) = scan
                    .iter()
                    .filter(|ping| ping.foe)
                    .filter(|ping| ping.id == *enemy_id)
                    .collect::<Vec<_>>()
                    .get(0)
               {
                    times_up_lets_do_this(&mech, enemy)
               } else {
                    find_raid(&mech)
               }
          } else if let Some(enemy) = scan
               .iter()
               .filter_map(|ping| if ping.foe { Some(ping) } else { None })
               .take(1)
               .collect::<Vec<_>>()
               .get(0)
          {
               times_up_lets_do_this(&mech, enemy)
          } else {
               find_raid(&mech)
          }
     } else {
          find_raid(&mech)
     }
}
/**
 * Strategy:
 * Move around (randomly? procedurally?)
 * Find enemy mech
 * Run & gun straight towards mech
 */
Move around (randomly. procedurally?)
Find enemy mech
Run & gun straight towards mech
Move around ( randomly . procedurally? ) Find enemy mech Run & gun straight towards mech
pub fn handler(mech: impl MechInstruments) -> Vec<MechCommand> {
     if let Some(scan) = mech.last_radar_scan() {
          // Prefer to destroy previous target
          if let Some(RegisterValue::Text(enemy_id)) = mech.register_get(EBX) {
               if let Some(enemy) = scan
                    .iter()
                    .filter(|ping| ping.foe)
                    .filter(|ping| ping.id == *enemy_id)
                    .collect::<Vec<_>>()
                    .get(0)
               {
                    times_up_lets_do_this(&mech, enemy)
               } else {
                    find_raid(&mech)
               }
          } else if let Some(enemy) = scan
               .iter()
               .filter_map(|ping| if ping.foe { Some(ping) } else { None })
               .take(1)
               .collect::<Vec<_>>()
               .get(0)
          {
               times_up_lets_do_this(&mech, enemy)
          } else {
               find_raid(&mech)
          }
     } else {
          find_raid(&mech)
     }
}
pub fn handler ( mech : impl MechInstruments ) -> Vec < MechCommand > { if let Some ( scan ) = mech . last_radar_scan ( ) { // Prefer to destroy previous target if let Some ( RegisterValue :: Text ( enemy_id ) ) = mech . register_get ( EBX ) { if let Some ( enemy ) = scan . iter ( ) . filter ( | ping | ping . foe ) . filter ( | ping | ping . id == * enemy_id ) . collect :: < Vec < _ > > ( ) . get ( 0 ) { times_up_lets_do_this ( & mech , enemy ) } else { find_raid ( & mech ) } } else if let Some ( enemy ) = scan . iter ( ) . filter_map ( | ping | if ping . foe { Some ( ping ) } else { None } ) . take ( 1 ) . collect :: < Vec < _ > > ( ) . get ( 0 ) { times_up_lets_do_this ( & mech , enemy ) } else { find_raid ( & mech ) } } else { find_raid ( & mech ) } }
Strategy:
 Move around (randomly?
Strategy : Move around ( randomly?
mech
impl MechInstruments
mech
impl MechInstruments