mdbtxt1
mdbtxt2
Proceed to Safety

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

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


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 2024 Apr 23. s.30