mdbtxt1
mdbtxt2
Proceed to Safety

Bitwise Parallel Computation with Block Fill and Copy    

The Sixteen Two-Argument Boolean Functions

A 0011
B 0101    Description
0000 0 (always false)    (0-argument function)
0001 A & B
0010 A & ~B
0011 A       (1-argument function)
0100 ~A & B
0101 B       (1-argument function)
0110 A ^ B    (A xor B)
0111 A v B    (A or B)
1000 ~(A v B)    (A nor B)
1001 ~(A ^ B)    (A xnor B)
1010 ~B    (not B)    (1-argument function)
1011 ~A v B    (A implies B)
1100 ~A    (not A)    (1-argument function)
1101 A v ~B    (B implies A)
1110 ~(A & B)    (A nand B)
1111 1 (always true)    (0-argument function)

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:

/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:

/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


Robert Munafo's home pages on AWS    © 1996-2024 Robert P. Munafo.    about    contact
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. Details here.

This page was written in the "embarrassingly readable" markup language RHTF, and was last updated on 2022 Nov 17. s.27