Bitwise Parallel Computation with Block Fill and Copy
Primitives
Data can be copied without modification with /clone using the most simple options.
Negation can be achieved in-place using a sequence of three /fill commands. In this example, 0 and 1 are represented by air and stone, and granite is used as the "temporary":
/fill x1 y1 z1 x2 y2 z2 granite 0 replace air
/fill x1 y1 z1 x2 y2 z2 air 0 replace stone
/fill x1 y1 z1 x2 y2 z2 stone 0 replace granite
Disjunction (logical "or") is done with a /clone using the masked option, which treats all air blocks as 0's and all non-air blocks as 1's:
/clone x1 y1 z1 x2 y2 z2 dx dy dz masked normal
All of the other 2-argument boolean functions can be built up using combinations of or and not, making it possible to implement any combinatorial function in bitwise parallel form. For example:
A and B = not(not(A) or not(B))
A xor B = not(A or not(B)) or not(B or not(A))
My practice examples
Restore starting configuration: /fill 230 68 323 238 68 326 air 0 /fill 231 68 323 231 68 326 stone 0 /fill 235 68 324 238 68 324 sand 0
In range A:
change air to cobblestone:
/fill 235 68 323 238 68 326 cobblestone 0 replace air
change sand to air:
/fill 235 68 323 238 68 326 air 0 replace sand
Then clone A onto B with options masked normal
/clone 235 68 323 238 68 326 230 68 323 masked normal
In range B:
Negate the result: /fill 231 68 323 234 68 326 granite 0 replace air /fill 231 68 323 234 68 326 air 0 replace stone /fill 231 68 323 234 68 326 air 0 replace cobblestone
The Sixteen Two-Argument Boolean Functions
|
This page was written in the "embarrassingly readable" markup language RHTF, and was last updated on 2024 Apr 23. s.30