let mut rowfilled = 0;
while rowfilled < ROOMLENGTH {
// Length of the plank is greater than the remainder room
if ROOMLENGTH - rowfilled > PLANKMAX {
// If this is the first plank
let end = rowfilled == 0;
// Store the full length plank
row.push(Plank {
length: PLANKMAX,
endpiece: end,
});
rowfilled += PLANKMAX;
// For each iteration, we have used another plank
plankcount += 1;
// If a whole plank was used, the leftover is 0
leftover = 0;
// Length of the plank is smaller than the room
} else {
// Add the remainder
let remainder = ROOMLENGTH - rowfilled;
row.push(Plank {
length: remainder,
endpiece: true,
});
rowfilled += remainder;
// Calculate the leftover plank length
leftover = PLANKMAX - (ROOMLENGTH - rowfilled);
}
let mut leftoverold = leftover;
}
rowlist.push(row);
// How much of the floor have been covered?
coverage += PLANKWIDTH;
}
*/
//println!("\nTotal amount of planks: {}\n", plankcount);
//println!("\n: {:#?}\n", rowlist);