Use the MaterialStorage
[?]
Mar 28, 2021, 11:21 AM
SMYRM2CFBM7BJYHAUIJYTSORS2V6O5GAHRSY2K6ELGOM3OF5VHCQCDependencies
- [2]
6ODVKCN4Fix printouts of relative lengths - [3]
3H2BGWRGWIP - [4]
5TH3AA4610 mm extra space - [5]
UPCMFGXFPrint more about the room and define PLAY - [6]
RQRFFUF6Can build the first basic row - [7]
F3GMCMWTMerge branch 'master' into sovrum - [8]
CT3VONTOIntroduce PLANKMIN and work with the neverending rows - [9]
2USDM5CHWIP for more generic - [10]
VSG6UWDYCan now build floors - [11]
Y4AQJ5RDOther defaults - [12]
ES2PMPT4Using structures instead - [13]
ZJPL7VNQSeparate planks from main - [14]
USO5PZWOStart with the print function, separate mutable and immutable functions - [15]
JBGHRTSWUse the new defaults - [16]
MLUGR2LLAdd default impl and some basic plank logic - [*]
C5VVJ5SOPrint how many rows
Change contents
- replacement in src/main.rs at line 20
//static PLANKMAX: u32 = 2200;static PLANKMAX: u32 = 1900;static PLANKMAX: u32 = 2200;//static PLANKMAX: u32 = 1900; - replacement in src/main.rs at line 25
static PLAY: u32 = 20;static PLAY: u32 = 5; - edit in src/main.rs at line 31[18.231][3.143]
// How many planks are available?// Add ability to add "used"/pre-cut planksstatic AVAILABLEPLANKS: u32 = 10; - replacement in src/main.rs at line 39
println!("Halloj golvläggare!)\n");println!("Halloj golvläggare!\n"); - edit in src/main.rs at line 46
// Create a pool of planks, modify the constant AVAILABLEPLANKS// to the total number of full length available plankslet ms = MaterialStorage::default(); - replacement in src/main.rs at line 51
let floor: Floor = Default::default();let floor: Floor = Floor::default();//println!("Material storage:\n {:#?}", ms); - replacement in src/main.rs at line 55
let finished_floor = floor_build(floor);let (finished_floor, ms) = floor_build(floor, ms); - edit in src/main.rs at line 58
println!("Number of leftover cut planks: {}", ms.get_used_count()); - replacement in src/main.rs at line 92
println!("Number of planks used: {}", plank_count_sum);println!("Number of planks required: {}", plank_count_sum); - replacement in src/main.rs at line 95
fn floor_build(mut floor: Floor) -> Floor {fn floor_build(mut floor: Floor, mut ms: MaterialStorage) -> (Floor, MaterialStorage) { - replacement in src/main.rs at line 98[3.674]→[3.1317:1349](∅→∅),[2.823]→[3.1317:1349](∅→∅),[3.1264]→[3.1317:1349](∅→∅),[3.1317]→[3.1317:1349](∅→∅)
floor.add(build_row());// TODO, deal with unwrapfloor.add(build_row(&mut ms).unwrap()); - replacement in src/main.rs at line 104
floor(floor, ms) - replacement in src/main.rs at line 107
fn build_row() -> Row {fn build_row(ms: &mut MaterialStorage) -> Option<Row> { - replacement in src/main.rs at line 112
let mut plank: Plank = Default::default();//let mut plank: Plank = Default::default();// Check if some started plank is available// otherwise grab a new plank from MaterialStoragelet mut plank;if ms.exists_used() {plank = ms.get_used()?;} else {plank = ms.get_new()?;//} else {//println!("No more planks available!");//plank = None;//}} - replacement in src/main.rs at line 182
rowSome(row)