I'm curious to see how your version of this works Red_Guy. I don't have a build optimizer yet, but I do have a script that given a volume, efficiently fills the area with bricks. If I did this I'd just make something to divide a build into rectangular cubes and then fill them up. I actually do have something like that already but it's not designed to split the cubes by brick color.
well the rules work with statements like this:
merge: '2x2' into: '2x10'
merge: '2x2' into: '2x8'
merge: '1x1' into: '2x12x5'
Then for each of those merge calls, it takes the smaller brick, and figures out how many will fit into the larger brick, and what locations they should be at. then it scans the bricks to see if any exist at the positions.
so for this one: merge: '2x4' into: '2x8'
with a 2x4 brick at 0,0,0 it looks for another 2x4 at 0,2,0, and if it finds one, it will delete both bricks and place a new 2x8 brick at 0,0,0
And then the same for merge: '2x2' into '2x8' It will look for 4 2x2 bricks in a row and if it finds them, delete all 4 and replace them with a single 2x8.
The "scan the bricks" task needs some kind of index lookup scheme, or the script will take hours to run. But once thats solved, it works nicely.