Fix floorbuilding
Dependencies
- [2]
XSS4V63LChange scale factor wider for more detail - [3]
4YYL4VTYIntroduce Cut - [4]
WT7LSRGIEach Row stores its maximum length - [5]
JEHKAQUUSimplify by using match - [6]
MLUGR2LLAdd default impl and some basic plank logic - [7]
SMYRM2CFUse the MaterialStorage - [8]
LXMNVVD2Change to proper measurements - [9]
OK5CKW6ERework everything, use references - [10]
VSG6UWDYCan now build floors - [11]
JPTYS433Cleanup, clippy - [12]
5TH3AA4610 mm extra space - [13]
ES2PMPT4Using structures instead - [14]
ZJPL7VNQSeparate planks from main - [15]
C5VVJ5SOPrint how many rows - [16]
AATEG4HIRemove todo, improve comment - [17]
USO5PZWOStart with the print function, separate mutable and immutable functions - [18]
Y4AQJ5RDOther defaults - [19]
DUC7IKTFPass in the previous row during building - [20]
Q7IWKL57Calculate required length once and reuse - [21]
CT3VONTOIntroduce PLANKMIN and work with the neverending rows
Change contents
- replacement in src/lib.rs at line 210[6.2464]→[6.29:85](∅→∅),[6.85]→[6.2157:2197](∅→∅),[6.2197]→[6.131:162](∅→∅),[6.131]→[6.131:162](∅→∅)
/// Increase the number of planks used for this rowpub fn add_used_planks(&mut self) {self.planks_used += 1;/// Return how many planks/pieces are in this rowpub fn get_used_planks(&mut self) {self.planks.len(); - replacement in src/lib.rs at line 216
pub fn add_coverage(&mut self, coverage: u32) {fn add_coverage(&mut self, coverage: u32) { - replacement in src/lib.rs at line 220
/// Get the number of plank rows for this floor/// Get the coverage so far of this row - edit in src/lib.rs at line 232
// Add the new plank to coverage, coverage is// thus the coordinate from originself.add_coverage(plank.length());// There is always a cut at the end of a row// only add Cut if less than thislet coordinate = self.get_coverage();if coordinate < self.row_max_length {self.cut_coordinates.push(Cut::new(coordinate));} - replacement in src/lib.rs at line 246
return self.cut_coordinates.clone();self.cut_coordinates.clone() - replacement in src/lib.rs at line 260
return true;true - replacement in src/constants.rs at line 21
pub static ROOMLENGTH: u32 = 4760;// pub static ROOMLENGTH: u32 = 4760;pub static ROOMLENGTH: u32 = 2220; - replacement in src/bin/main.rs at line 34
let scalefactor = 50;let scalefactor = 100; - replacement in src/bin/main.rs at line 97[6.1452]→[6.1647:1654](∅→∅),[6.1654]→[6.992:1095](∅→∅),[6.992]→[6.992:1095](∅→∅),[6.1095]→[5.0:110](∅→∅)
//// Check if some started plank is available// otherwise grab a new plank from MaterialStoragelet mut plank = match ms.get_used() {Some(plank) => plank,None => ms.get_new()?,};let mut plank; - replacement in src/bin/main.rs at line 100[6.64]→[6.578:617](∅→∅),[4.251]→[6.578:617](∅→∅),[6.3867]→[6.578:617](∅→∅),[6.617]→[6.1655:1763](∅→∅),[6.617]→[6.3901:3946](∅→∅),[6.1763]→[6.3901:3946](∅→∅),[6.3901]→[6.3901:3946](∅→∅),[6.3946]→[6.1764:1804](∅→∅),[6.1804]→[6.299:334](∅→∅),[6.4030]→[6.299:334](∅→∅),[6.334]→[6.4030:4040](∅→∅),[6.657]→[6.4030:4040](∅→∅),[6.4030]→[6.4030:4040](∅→∅)
if plank.length() < PLANKMIN {// Check if the plank is too short, then take a new onems.discard_unusable(plank);// Take a new plank and continueplank = ms.try_get_used()?;row.add_used_planks();}// Get a plank, used or new, and continueplank = ms.try_get_used()?; - edit in src/bin/main.rs at line 116
- edit in src/bin/main.rs at line 118
length if length < PLANKMIN => {// Check if the plank is too short, then take a new onems.discard_unusable(plank);} - edit in src/bin/main.rs at line 127
// also increase the row coveragerow.add_coverage(plankpart.length()); - replacement in src/bin/main.rs at line 134
// Use the whole plank, add to row coveragerow.add_coverage(plank.length());// Use the whole plank - edit in src/bin/main.rs at line 136
// Take a new plank and continueplank = ms.try_get_used()?;row.add_used_planks(); - replacement in src/bin/main.rs at line 140
// Use the whole plank, add to row coveragerow.add_coverage(plank.length());// Use the whole plank - edit in src/bin/main.rs at line 142
// Take a new plank and continueplank = ms.try_get_used()?;row.add_used_planks();