mdbtxt1
mdbtxt2
Proceed to Safety

# Bitwise Parallel Computation with Block Fill and Copy

The Sixteen Two-Argument Boolean Functions

 A 0 0 1 1 B 0 1 0 1 Description 0 0 0 0 0 (always false)   (0-argument function) 0 0 0 1 A & B 0 0 1 0 A & ~B 0 0 1 1 A     (1-argument function) 0 1 0 0 ~A & B 0 1 0 1 B     (1-argument function) 0 1 1 0 A ^ B   (A xor B) 0 1 1 1 A v B   (A or B) 1 0 0 0 ~(A v B)   (A nor B) 1 0 0 1 ~(A ^ B)   (A xnor B) 1 0 1 0 ~B   (not B)   (1-argument function) 1 0 1 1 ~A v B   (A implies B) 1 1 0 0 ~A   (not A)   (1-argument function) 1 1 0 1 A v ~B   (B implies A) 1 1 1 0 ~(A & B)   (A nand B) 1 1 1 1 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

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