## FANDOM

1,134 Pages

A logic gate in Powder Game and Powder Game 2 is a simple machine that takes input(s) (on/off) and performs a logical operation to provide an output (on/off). Logic gates can be made with a metal and thunder circuit, with laser and mirrors, or C-4. However, the former allows more complexity. Combinations of these three technologies are also possible.

## Mathematical analysis

For x inputs, there are $2^{2x}$ possible logic gates (assuming there is at least one input; there are 2 possible logic gates for zero inputs: the 1 gate and 0 gate, even though $2^{2*0}$ =1, as anything to the zeroth power is one).

## One input

There are four possible one-input logic gates. The last one is the normal gate that does not do anything. (1→1, 0→0)

### 0 gate

The 0 gate always produces an off output, regardless of the input. (0→0, 1→0)

### NOT gate

For the output to be on, the input must be off. (0→1, 1→0)

### 1 gate

The 1 gate always produces an on output, regardless of the input. (0→1, 1→1)

### ? gate

The ? gate always produces the input as the output. (0→0, 1→1)

## Two inputs

There are sixteen possible two-input logic gates: 0, AND, A > B, A, A < B, B, XOR, OR, NOR, XNOR, NOT B, A ≥ B, NOT A, A ≤ B, NAND, and 1.

### 0 gate

The 0 gate always produces an off output, regardless of the inputs. (00→0, 01→0, 10→0, 11→0)

### AND gate

For the output to be on, both inputs must be on. (00→0, 01→0, 10→0, 11→1)

### A > B gate

For the output to be on, A must be greater than B. (00→0, 01→0, 10→1, 11→0)

### A gate

For the output to be on, A must be on. (00→0, 01→0, 10→1, 11→1)

### XOR gate

For the output to be on, one, but only one, of the inputs must be on. (00→0, 01→1, 10→1, 11→0)

A more chance of working (but more complicated) XOR gate is to split the inputs and lead one of each input to a OR gate and a AND gate. The OR output is divided again, with one output simply destroyed and the other led to the A input of an A > B gate. The AND gate output is not divided, but sent the B input. The output of the A > B gate is the XOR output.

### OR gate

For the output to be on, one or both of the inputs must be on. (00→0, 01→1, 10→1, 11→1)

For both C-4 and metal/thunder, this type of gate is trivial.

### NOR gate

The output is off unless both inputs are off. (00→1, 01→0, 10→0, 11→0)

The below example usually works, but there is a slight chance of failure.

This function of this gate is achieved by putting two inputs through an OR gate and putting the output through a NOT gate.

### NAND Gate

The output is on unless both inputs are on. (00→1, 01→1, 10→1, 11→0)

However, the input that becomes the output has to be stronger than any one of the inputs, but weaker than both combined (2 Inputs > Output > 1 Input), acting like a circuit breaker.

### 1 gate

The 1 gate always produces an on output, regardless of the inputs. (00→1, 01→1 10→1, 11→1)

## Logic organizers

Logic organizers are mainly for sorting pathways for lasers or electricity.

However, there aren't any available codes to demonstrate this. These gates are very similar to logic gates, except they use wood, thunder, metal and rarely torch.

Many Powder Game authors have been known to make these, but few have been used in uploads.

Conventional half adders connect Or, And, and Not gates together to do binary arithmetic. In powder game however, this can be hard to do. To make half adders smaller and more efficient, a type of system has been invented to achieve the same mathematical outcomes. They are so small and simple that they are considered a logic gate on their own. An example may be seen here:

10100000a400000000100*02102*01*03*06*05*01w00q00004000v00u01u0B*0200Du0F00Cv0E10E00Ku0J*0Hv0Lu0G*0Bv0Q00N10M*0Pu0O*0Su0X00I10V*0Y10b00au0R00e00Uu0fv0T*0W10dv0j*0cu0iu0Zv0m00g*0ku0o10lu0pu0v10u10xu0tu0z00h00**0s010*0n01200r*13*11*17*16*1901501Bv0qv1Du0wu0.*1801Cu1F014v1E10y01Ku1J*1Hv1Lu1G*1Av1Q01N11M*1Pu1O*1Su1X01I11V*1Y11b01au1R01e01Uu1fv1T*1W11dv1j*1cu1iu1Zv1m01g*1ku1o11lu1pu1v11u11xu1tu1z01h01**1s00*u00y00T00s0Bq24s0Bm00x0Ju23T26T2C00AT28x2Ay2402E02Iq2Hm2910Mu2B02JT2Dm2Lu0Bu2Nq2Hq2TT2F10Mt2Bt0Bp24t2Vu0Bt2Nv2Hs2Q000t2cT0Bs2et2g025x0Jt2js2iy2Hv2dx2ly2oT2hx0Jm2360Br0062Hp2w00A62Hz00c0D000m00w0Jz2962v62Io2wp0Bo24p0Bz2*p00300o2*q28w0Jq2uo2*o37c3DT00p3I60By3I33Oc3L031w3Gy2wo00f00h37f3V63Lf3Xo0Bx3Po3Cc3Qm3210My3403Le00S2Y63Dh3D63Lh3lp3Vo3T029c3D33Lc0A03R10Mq3Hh3nh3xo3px3b33B03uu26y3p63t643p3ac3rc46p3F10Mz3gr3702wq0B643o3Nc46o3c32*040031y2Ho39024q0BT3TT4O64F33Dc3L33I04Jm2Bq4Qq2464Yo4YT2yy2*v48u2vy24x2wT2yr2ew2NT2Ds4iy24u2s13fy2U02k14oT4kx0Jy2ST4nu3Ny4ps4ix3*o4Uc3Qc4*04Iq3*c4*p38c3D04Is3eu0Bw3q04Ic0Bc5B05A05Dc2vc5404Io5Hc5Cc2hw0Jw59p52o54o54p5F04S05I04Sp5Cs57032x4Ip5E05Yo56c5Gc5Go5Ys5Vw3qp5J05Yc5Gs5Ip5cc5Jp26w0Jv3qr00n54r5p03Lw1wu1.*21*5v*1n020*5x*5w01r*5z*6005*062v1qv64u5t05y063u66*5.v6511y067v6Bu5u*61v6E06Du69*6Gu6J06816C*6Au6Lv6H*6O16N*6K16S06Mu6F06V06I16Uv6Q*6Tu6Wv6a06X*6Ru6cu0w*0710416j*6iw0A0aA5
```The arithmetic is very simple for using one of these:
```

0+0=0 and carry 0

1+0=1 and carry 0

0+1=1 and carry 0

1+1=0 and carry 1

## Laser logic

Logic gates can be constructed from lasers. Lasers are usually dealt with using "tubes," which is a common name for the device usually used to construct logic gates out of lasers. A tube consists of two lines of metal (usually vertical) which are parallel and form a "tube". The two metal lines are usually two pixels apart. It is possible to pass a laser diagonally into one end of a tube so that it bounces between the two metal pieces until exiting the other end. This may be referred to as the "Z" laser. There may be one or more "Z" lasers. A second laser is then passed parallel to the two metal lines and touching the side of one of the lines. It does this in such a way that is intersects every other point at which the "Z" laser reflects and each time, has a high probability of blocking the "Z" laser. This blocking or "B" laser then exits the other end of the tube. There may be one or more "B" lasers. Therefore, a "B" laser, if present, will block any "Z" lasers present. This function highly resembles that of a normally closed relay.

While the "B" laser can usually block the "Z" laser in one or two intersection regardless of direction there are some handy standards to keep in mind. A well constructed tube will usually have the "Z" and "B" lasers heading in from opposite ends of a tube. Also, both pieces of metal in a tube are usually nine pixels long. This will ensure (given a laser of adequate density) that the "Z" laser(s) are always blocked when a "B" laser is going through.

Tubes usually have pieces of metal two pixels long, parallel to them, and adjacent to each corner. These pieces of metal (called flanges) are merely convenient in most cases as they bend a laser diagonally. A laser, intended to be a "Z" laser can be shot in a non diagonal manner at the end of one of the tube walls, the flange of metal will bend it diagonally and send it properly out of the tube, and if it emerges a second flange will bend it back onto it's previous trajectory.

0030000000100*02102*01*03*06*05*01w00q00004000v00u01u0B*0200Du0F00Cv0E10E00Ku0J*0Hv0Lu0G*0Bv0Q00N10M*0Pu0O*0Su0X00I10V*0Y10b00au0R00e00Uu0fv0T*0W10dv0j*0cu0iu0Zv0m00g*0ku0o10lu0pu0v10u10xu0tu0z00h00**0s010*0n01200r*13*11*17*16*1901501Bv0qv1Du0wu0.*1801Cu1F014v1E10y01Ku1J*1Hv1Lu1G*1Av1Q01N11M*1Pu1O*1Su1X01I11V*1Y11b01au1R01e01Uu1fv1T*1W11dv1j*1cu1iu1Zv1m01g*1ku1o11lu1pu1v11u11xu1tu1z01h01**1s020*1n02201r*23*21*27*23n00y00T0Bq2B000n2A10Mn2AT2CT0Bn2Fu0Bo2H000o2Do2K02Ny2OT2Ly0Jo2Mo2Oy2Ty2R02Q10Mo2UT2S12Zy2Xo2Po2a02Yu2ST2LT2bu2h02NT2j02Ey2Dq2Dn2Pn2Mq2py1wu1.*2802502wv1qv2yu2t024v2z11y02*u2.*2vv30u2u*26*3702xu33*38v35032131*34u3A03913E*3Bu3Gv3C*3F13I03Hu3603O03Du3Pv3L*3J13Nv3T03Q*3Mu3Su3Ku3a13Vu3bu3Z13c13fu0t*0710413j*3iw0A0nI0

## Mercury switch logic

Only possible in Powder Game 2, logic gates can utilize mercury switches to produce an output.

The following example includes all gates mentioned above. Instructions for use are included.