Swap rows after adding the plank

AfoHT
Jan 26, 2024, 10:57 PM
4LWUJOG3UQUPA3PI3C5CEBZTQYEGAFI7DDNRMLR6AHJG7JJWHD6QC

Dependencies

  • [2] NJC3HBR6 Initial attempt to not get too short planks at end of row
  • [3] GKK5DEP5 Calculate coordinate once, swap rows if too close
  • [4] MLUGR2LL Add default impl and some basic plank logic
  • [5] RYT4PXCX Cut coordinate is relative the new plank
  • [6] 4YYL4VTY Introduce Cut
  • [7] E6F2AEXP Fix floorbuilding
  • [8] FMZGVTH3 Remove some debug printouts
  • [9] LRBLK2ZM Add env_logger
  • [10] LQ4TT46N These conditions are not mutually exclusive
  • [11] ZJPL7VNQ Separate planks from main
  • [*] 5TH3AA46 10 mm extra space
  • [*] JPTYS433 Cleanup, clippy

Change contents

  • edit in src/bin/main.rs at line 76
    [2.463][2.463:473](),[2.473][4.1186:1238](),[4.1186][4.1186:1238](),[4.1313][4.1313:1385](),[4.1385][3.0:285](),[3.285][4.0:14](),[4.1570][4.0:14]()
    }
    if let Some(adjacent_row) = adjacent_row {
    // Check if the new plank lands too close to a previous cut
    // or a new one
    let coordinate = row.get_coverage() + required_length;
    if !adjacent_row.check_if_cut_is_valid(Cut::new(coordinate)) {
    log::info!("Invalid cut at {coordinate}!!! Swapping places");
    row.swap_latest(ms);
    }
  • edit in src/bin/main.rs at line 103
    [14.1644]
    [14.1777]
    }
    }
    if let Some(adjacent_row) = adjacent_row {
    // Check if the newly added plank lands too close to a previous cut
    // or a new one
    let coordinate = row.get_coverage();
    if !adjacent_row.check_if_cut_is_valid(Cut::new(coordinate)) {
    log::info!("Invalid cut at {coordinate}!!! Swapping places");
    println!("{row}");
    row.swap_latest(ms);