fn move_to_center(mech: &impl MechInstruments) -> Vec<MechCommand> {
     let mut cmds = vec![];
     let center = compute_center(mech.world_size());

     for _ in 0..distance_to(&mech.position(), &center) {
          if cmds.len() < 3 {
               cmds.push(mech.move_mech(mech.direction_to(&center)));
          } else {
               break;
          }
     }

     cmds
}
/// Up to 3 moves to allow for an extra action
Up to 3 moves to allow for an extra action
Up to 3 moves to allow for an extra action
fn move_to_center(mech: &impl MechInstruments) -> Vec<MechCommand> {
     let mut cmds = vec![];
     let center = compute_center(mech.world_size());
     for _ in 0..distance_to(&mech.position(), &center) {
          if cmds.len() < 3 {
               cmds.push(mech.move_mech(mech.direction_to(&center)));
          } else {
               break;
          }
     }
     cmds
}
fn move_to_center ( mech : & impl MechInstruments ) -> Vec < MechCommand > { let mut cmds = vec ! [ ] ; let center = compute_center ( mech . world_size ( ) ) ; for _ in 0 .. distance_to ( & mech . position ( ) , & center ) { if cmds . len ( ) < 3 { cmds . push ( mech . move_mech ( mech . direction_to ( & center ) ) ) ; } else { break ; } } cmds }
Up to 3 moves to allow for an extra action
Up to 3 moves to allow for an extra action
mech
&impl MechInstruments
mech
&impl MechInstruments