Fix printouts of relative lengths

[?]
Mar 24, 2021, 9:44 PM
6ODVKCN4BSPLQJYHHDEZZQACKE5WGVYUWC7IDXN3D3HMBC6RBA7QC

Dependencies

  • [2] Y4AQJ5RD Other defaults
  • [3] ES2PMPT4 Using structures instead
  • [4] 5TH3AA46 10 mm extra space
  • [5] ZJPL7VNQ Separate planks from main
  • [6] MLUGR2LL Add default impl and some basic plank logic
  • [7] CT3VONTO Introduce PLANKMIN and work with the neverending rows
  • [8] VSG6UWDY Can now build floors
  • [9] USO5PZWO Start with the print function, separate mutable and immutable functions
  • [10] C5VVJ5SO Print how many rows
  • [11] UPCMFGXF Print more about the room and define PLAY
  • [12] 2USDM5CH WIP for more generic

Change contents

  • edit in src/main.rs at line 1
    [3.1]
    [3.3538]
    #![allow(dead_code)]
  • replacement in src/main.rs at line 21
    [2.378][2.378:406]()
    static PLANKMAX: u32 = 800;
    [2.378]
    [3.509]
    static PLANKMAX: u32 = 1900;
  • replacement in src/main.rs at line 36
    [3.100][3.287:340](),[3.340][2.500:538](),[2.538][3.392:399](),[3.392][3.392:399]()
    println!(
    "Room dimensions: {} x {} mm",
    ROOMLENGTH,
    ROOMDEPTH
    );
    [3.100]
    [3.182]
    println!("Room dimensions: {} x {} mm", ROOMLENGTH, ROOMDEPTH);
  • edit in src/main.rs at line 38
    [3.223]
    [3.186]
    println!("Sawblade size: {} mm", SAWBLADE);
    println!("Plank width: {} mm", PLANKWIDTH);
    println!("Plank length: {} mm", PLANKMAX);
  • edit in src/main.rs at line 47
    [2.573][3.232:233](),[3.577][3.232:233](),[3.1250][3.232:233]()
  • edit in src/main.rs at line 50
    [2.612][2.612:613]()
  • edit in src/main.rs at line 52
    [2.638][2.638:667]()
    let mut plank_count = 0;
  • replacement in src/main.rs at line 55
    [2.757][2.757:839]()
    plank_count = row.planks_count();
    plank_count_sum += plank_count;
    [2.757]
    [3.720]
    plank_count_sum += row.planks_count();
  • replacement in src/main.rs at line 58
    [2.887][2.887:936]()
    print!("|{:-^10}|", plank.length());
    [2.887]
    [2.936]
    print!("|");
  • replacement in src/main.rs at line 60
    [2.937][2.937:1045]()
    // Calculate the parts needed for printing
    //let parts = printmax / plank_count as
    [2.937]
    [3.808]
    // Print half the relative length of the plank
    for _ in 0..(plank.length() / printmax) / 2 {
    print!("-");
    }
  • edit in src/main.rs at line 65
    [3.809]
    [3.809]
    // Print the numeric length
    print!("{:-^5}", plank.length());
  • replacement in src/main.rs at line 68
    [3.810][3.810:1378]()
    /*
    if planklist[x].0 == ROOMLENGTH {
    println!("|{:-^22}|", ROOMLENGTH);
    } else {
    // If x is odd
    if planklist[x].0 == planklist[x].1 {
    println!("|{:-^10}||{:-^10}|", planklist[x].0, planklist[x].1)
    } else if planklist[x].0 < planklist[x].1 {
    println!("|{:-^7}||{:-^13}|", planklist[x].0, planklist[x].1)
    } else {
    println!("|{:-^13}||{:-^7}|", planklist[x].0, planklist[x].1)
    }
    [3.810]
    [3.1378]
    // Print the rest of the plank including the end
    for _ in 0..(plank.length() / printmax) / 2 {
    print!("-");
  • replacement in src/main.rs at line 72
    [3.1392][3.1392:1415]()
    */
    [3.1392]
    [3.1415]
    print!("|");
  • replacement in src/main.rs at line 84
    [3.674][2.1205:1264]()
    println!("coverage: {:#?}", floor.get_coverage());
    [3.674]
    [3.1317]
    //println!("coverage: {:#?}", floor.get_coverage());