Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RULE LLLL
- LLLL By Lode Vandevenne (2014-2015)
- (alternate version with icons)
- A cellular automaton rule allowing design of logic circuits, such as a computer chip. It is loosely based on WireWorld and Minecraft redstone. It uses von Neumann neighborhood (4 neighbors) and full perumtation symmetry (order of neighbors does not matter). It has 8 types of components (wire, diode input, inverting input, diode output, inverted output, xor output, counter output, substrate) with 4 excitment states (off, head, on, tail) each, plus background makes 33 states. De Morgan's law allows OR, NOR, AND and NAND with 3 cells. Input cells all also take the XOR of inputs, allowing a 2-cell XOR gate. There is a 3x3 cell tileable wire crossing. The rules allow easy toggling on and off inputs in Golly, making it interactive.
- Comparing with WireWorld, the main difference is that LLLL can work with constant on and off signals, while WireWorld works with short pulses. This allows a more traditional chip-like design rather than using exact timing of single electrons. This at the cost of way more states and rules. This makes it act more like Minecraft redstone than WireWorld.
- Comparing with MineCraft redstone: the red cell (invertor output) works like the redstone torch, with a blue cell (diode input) being the block the torch is attached to, and grey cells (wire) being the redstone wires. However, in LLLL more types of cells are available, allowing gates with less blocks than it'd be in MineCraft.
- It may be funny that XOR is the simplest gate here while in electronics it requires the most transistors, but this is a really good way to make circuits in this cellular automaton a lot more managable and compact, especially for the 3x3 wire crossing.
- The name LLLL stands for Lazy Logic Like Language. Lazy because the cellular automaton works like a lazy algorithm, components don't look ahead more than one cell through wires.
- List of states:
- 0: ' ': background [BLACK]
- 1: '.': wire off [DARK GREY]
- 2: 'h': wire head [LIGHT GREY]
- 3: '*': wire on [WHITE]
- 4: 't': wire tail [DARKEST GREY]
- 5: 'a': diode input off [DARK BLUE]
- 6: 'E': diode input head [MEDIUM BLUE]
- 7: 'A': diode input on [LIGHT BLUE]
- 8: 'e': diode input tail [DARKEST BLUE]
- 9: 'i': invertor input off [DARK ORANGE]
- 10: 'J': invertor input head [MEDIUM ORANGE]
- 11: 'I': invertor input on [LIGHT ORANGE]
- 12: 'j': invertor input tail [DARKEST ORANGE]
- 13: 'b': diode output off [DARK GREEN]
- 14: 'D': diode output head [MEDIUM GREEN]
- 15: 'B': diode output on [LIGHT GREEN]
- 16: 'd': diode output tail [DARKEST GREEN]
- 17: 'c': invertor output off [DARK RED]
- 18: 'S': invertor output head [MEDIUM RED]
- 19: 'C': invertor output on [LIGHT RED]
- 20: 's': invertor output tail [DARKEST RED]
- 21: 'x': xor output off [DARK YELLOW]
- 22: 'Y': xor output head [MEDIUM YELLOW]
- 23: 'X': xor output on [LIGHT YELLOW]
- 24: 'y': xor output tail [DARKEST YELLOW]
- 25: 'm': counter output off [DARK MAGENTA]
- 26: 'N': counter output head [MEDIUM MAGENTA]
- 27: 'M': counter output on [LIGHT MAGENTA]
- 28: 'n': counter output tail [DARKEST MAGENTA]
- 29: 'u': substrate off [DARK CYAN]
- 30: 'V': substrate head [MEDIUM CYAN]
- 31: 'U': substrate on [LIGHT CYAN]
- 32: 'v': substrate tail [DARKEST CYAN]
- The list gives 4 different identifiers for each state, all 4 are used interchangeably in the documentation:
- -The index number: E.g. instructions might say "while the CA is running in Golly, click at that position with state number 18"
- -The ASCII symbol: used in diagrams in this documentation, e.g. a wire with diode is ....ab....
- -The name. If the excitment state (e.g. 'head') is not mentioned, it refers to any. And simply "output" refers to any of diode, invertor or counter output. Similar for "input".
- -The color, as displayed in e.g. Golly. Usually here too the excitment state is left out, e.g. 'red cell' or 'red block' refers to any invertor output
- No attempt has been done to minimize the amount of states or rules. Rather, compactness and convenience are preferred, but all while remaining a permutable von Neumann neighborhood.
- The rules, rough description:
- -In the order from top to bottom, first rule matching gets executed. If nothing matches it keeps state.
- -Wires touching output head become head
- -Wires touching output tail but no output on/head become tail
- -Wire tail touching output on becomes head
- -Substrate touching input head become head
- -Substrate touching input tail but no input on/head become tail
- -Substrate tail touching input on becomes head
- -Electricity flows through wires/substrate with heads turning off wires/substrate on and tails turning on wires/substrate off
- -Diode inputs go on/off (temporarily head/tail when just triggered) when touching odd/even amount of on wires
- -Invertor inputs go on/off (temporarily head/tail when just triggered) when touching even/odd amount of on wires
- -Unconnected (to diode input) diode/invertor outputs serve as permanent tails/heads for wire
- -Diode outputs go on/off (temporarily head/tail when just triggered) when touching zero/some on inputs/substrate
- -Invertor outputs go on/off (temporarily head/tail when just triggered) when touching some/zero on inputs/substrate head/tail
- -Xor outputs go on/off (temporarily head/tail when just triggered) when touching odd/even amount of on inputs/substrate head/tail
- -Counter outputs flip state (temporarily head/tail when just triggered) when touching an input/substrate head while not touching any input/substrate tail or off
- -Off wire touching on wire becomes head. This rule is for convenience only (some "auto-warmup"), see section about warmup
- -Off substrate touching on substrate becomes head. Here it's not for convenience but because substrate can form long gates, to keep the OR effect working in flaky situations.
- Some notable effects of the rules:
- -Cells can switch between their 4 excitment states but keep their type (e.g. invertor can never become wire, etc...)
- -Wires read only from wires and outputs, Inputs read only from wires, Outputs read only from inputs and substrate, substrate reads only from inputs
- -Substrate (don't worry about its name) is very similar to wire, but sits between inputs/outputs rather than outside inputs/outputs (it's an optional way to make the inside of logic gates longer, for more compact circuits).
- -Substrate and wire don't interact so can touch each other without interfering.
- -Some cases of on and off states touching each other without head or tail in between, don't interact, e.g. on diode output touching off wire.
- -Touching inputs don't interact with each other
- -Touching outputs also don't interact with each other
- -Invertor inputs can be attached to diode outputs and vice versa (or with substrate in between).
- The rules, in full detail:
- *** Output to wire ***
- -Any wire touching diode/invertor/xor/counter output head becomes head
- -Any wire touching diode/invertor/xor/counter output tail but not any diode/invertor/counter output head/on becomes tail
- -Tail wire touching on diode/invertor/xor/counter output becomes head
- *** Input to substrate ***
- -Any substrate touching diode/invertor input head becomes head
- -Any substrate touching diode/invertor input tail but not any diode/invertor input head/on becomes tail
- -Tail substrate touching on diode/invertor input becomes head
- *** Within wires ***
- -On-wire touching tail wire becomes tail
- -Off wire touching head wire becomes head
- -Head wire touching tail wire and no wire/output head/on states becomes tail
- -Head wire not touching tail becomes on-wire
- -Tail wire touching head wire and no wire/output tail/off becomes head
- -Tail wire not touching head wire becomes off wire
- *** Within substrate ***
- -On-substrate touching tail substrate becomes tail
- -Off substrate touching head substrate becomes head
- -Head substrate touching tail substrate and no substrate/output head/on states becomes tail
- -Head substrate not touching tail becomes on-substrate
- -Tail substrate touching head substrate and no substrate/output tail/off becomes head
- -Tail substrate not touching head substrate becomes off substrate
- *** Diode Input ***
- -Off or tail diode input touching odd amount of on/head wires becomes head
- -Head diode input touching odd amount of on/head wires becomes on
- -On or head diode input touching even amount of on/head wires becomes tail
- -Tail diode input touching even amount of on/head wires becomes off
- *** Invertor Input ***
- -Off or tail diode input touching even amount of on/head wires becomes head
- -Head diode input touching even amount of on/head wires becomes on
- -On or head diode input touching odd amount of on/head wires becomes tail
- -Tail diode input touching odd amount of on/head wires becomes off
- *** Unconnected outputs serving as circuit inputs ***
- -Any diode output touching no diode inputs goes to tail state
- -Any invertor output touching no diode inputs goes to head state
- -Any diode input touching no wire goes to tail state
- -Any invertor input touching no wire goes to head state
- *** Diode Output ***
- -Off or tail diode output touching some amount of on/head inputs/substrate becomes head
- -Head diode output touching some amount of on/head inputs/substrate becomes on
- -On or head diode output touching zero amount of on/head inputs/substrate becomes tail
- -Tail diode output touching zero amount of on/head inputs/substrate becomes off
- *** Invertor Output ***
- -Off or tail invertor output touching zero amount of on/head inputs/substrate becomes head
- -Head invertor output touching zero amount of on/head inputs/substrate becomes on
- -On or head invertor output touching some amount of on/head inputs/substrate becomes tail
- -Tail invertor output touching some amount of on/head inputs/substrate becomes off
- *** Xor Output ***
- -Off or tail diode output touching odd amount of on/head inputs/substrate becomes head
- -Head diode output touching odd amount of on/head inputs/substrate becomes on
- -On or head diode output touching even amount of on/head inputs/substrate becomes tail
- -Tail diode output touching even amount of on/head inputs/substrate becomes off
- *** Counter Output ***
- -Counter output touching at least one of input or substrate heads, but not touching any off or tail input or substrate, flips state from off/tail to head, on/head to tail
- -Otherwise, counter output head becomes on
- -Otherwise, counter output tail becomes off
- *** Fixing wire/substrate internals ***
- -Off wire touching on wire becomes head. This prevents requiring many signals before the following wire works: ...***...***...***...***... (see section about warmup)
- -Off substrate touching on substrate becomes head. For same reason.
- What reads/writes from/to what
- ------------------------------
- -Wires read from wires and outputs
- -Inputs read from wires (But inputs not touching any wires read from outputs)
- -Substrate reads from inputs and substrate
- -Outputs read from inputs and substrate (But outputs not touching any wires don't read from inputs)
- -Wires write to wires and inputs
- -Inputs write to substrate and outputs (but not to outputs that don't touch any wires)
- -Substrate writes to substrate and outputs
- -Outputs write to wires (and to inputs that don't touch any wires)
- ............................
- . .
- . +----------------------+ .
- . | | .
- /v v | /v v .
- +--> wire --> input --> substrate --> output --+
- | |
- +----------------------------------------------+
- Wires
- -----
- Electricity (the 'on' states lead by 'head' and finished by 'tail') moves through wires: a head moves into off zones, leaving a trail of On cells behind. A tail does the opposite. The following configurations all move to the right (shift by 1 per tick):
- ......th......
- ....t****h....
- ******ht******
- ****h....t****
- Because the rules are symmetrical, this also works around corners in bent wires. The signals also split through multiple cells at junctions.
- Diodes and Invertors
- --------------------
- A diode is made of two cells: a blue and a green one (diode input and diode output). For an invertor, the green one is replaced by a red one (invertor output), or alternatively, the blue one is replaced by an orange one (invertor input).
- A diode input (blue) reads only from wires as input, it ignores anything else (including other diode inputs). Diode and invertor outputs only read from the blue cells. Wires, on their turn, read from diode/invertor outputs (and other wires, but they don't read from diode inputs, only write to)
- So the diode is directional: some input (diode input or invertor input) reads from the wire, and some output (diode output, invertor output, or counter (see later)) reads from that input, and then outputs to a wire again.
- A diode works like this:
- off state:
- ....ab....
- power came in from the left side:
- ****AB****
- power came in from the right side:
- ....ab****
- An invertor works similar, but its output is inverted, resulting in this steady state (before and after current coming in from the left):
- ....aC****
- ****Ac....
- Note that there is redundancy: there are two ways to make a diode, and two ways to make an invertor. The reason is that it allows making smaller logic gates, see further. To clarify:
- -diode input + diode output = diode
- -invertor input + invertor output = diode (because two inversions cancel each other out)
- -diode input + invertor output = invertor
- -invertor input + diode output = invertor
- Substrate
- ---------
- Substrate is very similar to wires, but sits in between input and output rather than outside of output. It allows making the inside of diodes, invertors or gates longer, e.g.:
- ....ab..... --> short diode
- ....auuuuuuuub -> long diode
- Substrate is optional but can make circuits more compact, especially logic gates (see further), where 1 substrate cell can sit between two inputs and one output.
- It does not interact with wires at all. So another semi-useful side effect is that this way signals can pass right next to each other without interfering:
- ...............
- uuuuuuuuuuuuuuu
- ...............
- uuuuuuuuuuuuuuu
- Logic Gates
- -----------
- Diode/invertor inputs/outputs allow making logic gates.
- OR gate (the reason inputs/outputs are needed is to avoid one input signal crawling back into the other input):
- ...a
- b.......
- ...a
- With the De Morgan's rule, a similarly shaped AND gate can be made: use invertor inputs and outputs instead:
- ...i
- c......
- ...i
- NOR gate:
- ...a
- c.....
- ...a
- NAND gate:
- ...i
- b.....
- ...i
- Becauce a and x take the XOR of their inputs, making a XOR gate is easy. Here are two ways:
- ...
- ax....
- ...
- ...a
- x....
- ...a
- XOR gates also allow a compact wire crossing. The crossing is directional. The one below supports flow from left to right and top to bottom (the b's are the output sides):
- .
- .a
- ....ax...
- ax
- .
- .
- It is possible to make logic gates with full diodes, but are then bigger, for example an AND gate can be made the way it is in MineCraft redstone:
- ...ac
- .ac....
- ...ac
- See llll_specification.mc for much more gates and components.mc for entire contraptions such as binary multipliers etc...
- Counters
- --------
- A convenient extra component is the counter. This is a 1-input toggle flip flop, which has input or substrate as its input, but the magenta counter cell (rather than green or red cell) as output. Whenever it receives an input head or substrate tail (or odd amount of those) at the input, it toggles its state. It's a "perfect" T-flip flop supporting the smallest possible signal.
- If it has multiple inputs, it only reacts if all inputs are on (it reacts to the last head). This AND behavior is chosen (rather than the more obvious choice of XOR) because it is possible to make more compact SR and D latches that way: many flip flop circuits made from a counter involve an AND gate as input to the counter.
- It's possible to build something similar to the counter out of the other components (e.g. with SR latches made from NAND gates), but those are larger and require more time and longer input signals to become stable. The counter block allows building more compact and stable flipflops, binary counters, long delay clocks, etc...
- Other than that, similar rules as the green and red outputs apply. That is, it has inputs or substrate as input, wires as output, and does not interact with other magenta, red or green cells.
- Unconnected Diode/Invertor Outputs As Permanent Inputs
- ------------------------------------------------------
- As a special rule, a diode/invertor output that is not connected to any diode input remains in respectively head/tail state forever. That means any wire those loose green or red block connect to, are respectively a permanent tail or permanent head. These serve as permanent signal inputs.
- As a special trick in golly, a convenient mouse-controlled toggle switch can be made with this: Have a wire touch a disconnected green block. Then pick block type 18 'invertor output head'. Then have an empty cell next to said wire, and click to toggle it to cell 18, click again to toggle it off. By toggling it off, the 'tail' signal of the green block takes over again, while when on the head overrules the tail. A perfect interactive toggle switch! So in electronic contraptions, just select block type 18, and click on a black cell next to any wire touching a green cell to toggle the input on to activate the contraption.
- A different type of input is much bigger and easy to aim when zoomed out in golly: make a large plane of off wire (1). Connect one counter (blue 5 and magenta 25) to it. Also connect one loose green block to it (16). Then, select color 2 ('head'). Whenever you click with the mouse on the big wire plane, it sends out the head to the counter which toggles, and the green block causes tail to reset the wire to off state again, so it's ready for a next click. This allows easy toggling of an input without careful aiming at a single cell with the mouse. Remove the counter (or add a change detector behind the counter) to send out a pulse with every click, e.g. for calculator buttons. When using the switch, don't click in fast succession because if a head and a tail touch, an oscillating pattern that is hard to clean occurs.
- Warmup
- ------
- When on cells touch off cells without head or tail in between, they can be stuck. A convenience rule fixes this for wires (off wire touching on wire becomes head) and substrate. However, it can still happen with e.g. an on invertor output touching an off wire, etc... (in theory rules to fix those could be added as well, but it's not done)
- These states often occur while building a circuit. A side effect of this is that the circuit may need to be warmed up before it works correctly. This is done by sending a few on/off signals through each input or combination of inputs.
- An example of something require a lot of warmup before a signal successfully passes from left to right:
- ....aC.aC.aC.aC.aC.aC....
- Tips
- ----
- Tip 1:
- When designing/editing circuits, it doesn't really matter which excitment state of each cell you use. Just pick any red cell as invertor output, any grey or white cell as wire, etc... The circuits will stabilize when ran but may require warmup as explained under "warmup".
- Tip 2:
- When looking at circuits in the provided demo files, typically inputs are marked with one green cell next to a wire that doesn't touch any blue cells (see explanation under "Permanent Inputs")
- However, if that is not present, then you can still recognize what are the inputs and outputs: the input sides usually have blue or orange cells, while the output side has green, yellow, red or magenta cells. For example the 9-cell wire crossing: the two input wires enter a blue cell, the two output wires start at a yellow cell. Also true for the logic gates.
- Tip 3:
- For editing in Golly:
- -use selections, copy and paste
- -moving a selection is done with cut and paste instead
- -there is a selection paste mode "copy" to avoid the overlapping
- -golly can run complicated circuits like the calculator extremely fast, but for seeing something happen, a delay of 0.025s is nice
- -to draw a straight line, either use the arrow keys while the mouse button is down, or use the "draw-lines.py" script.
- "Minimal Set"
- -------------
- Lots of cell types are redundant, for example there are multiple ways of making diodes, multiple xor gates, you can make T flipflop without using counter cell, ...
- To avoid such redundancy, it is possible to limit oneself to only the following cell types:
- -isolator
- -wire
- -diode input
- -diode output (not strictly needed)
- -invertor output
- Or alternatively, to go for NAND logic, choose this set and don't use the XOR ability of inputs:
- -isolator
- -wire
- -invertor input
- -diode output
- ################################################################################
- ################################################################################
- ################################################################################
- ################################################################################
- @TABLE
- n_states:33
- neighborhood:vonNeumann
- symmetries:permute
- #anything (don't care)
- var xa = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}
- var xb = {xa}
- var xc = {xa}
- var xd = {xa}
- #any wire state
- var wa = {1,2,3,4}
- var wb = {wa}
- var wc = {wa}
- var wd = {wa}
- #anything except wires
- var nwa = {0,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}
- var nwb = {nwa}
- var nwc = {nwa}
- var nwd = {nwa}
- #anything that is zero for diode input (that is, anything except wire on or wire head)
- var za = {0,1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}
- var zb = {za}
- var zc = {za}
- var zd = {za}
- #anything that is one for diode input (wire head or wire on)
- var oa = {2,3}
- var ob = {oa}
- var oc = {oa}
- var od = {oa}
- #off or tail wire
- var ooa = {1,4}
- var oob = {ooa}
- var ooc = {ooa}
- var ood = {ooa}
- #anything that is zero for diode output
- var ba = {5,8,9,12,29,30}
- var bb = {ba}
- var bc = {ba}
- var bd = {ba}
- #anything that is one for diode output (input/substrate on/head)
- var aa = {6,7,10,11,30,31}
- var ab = {aa}
- var ac = {aa}
- var ad = {aa}
- #anything that is zero or neutral for diode output (that is, anything except input/substrate on/head)
- var bna = {0,1,2,3,4,5,8,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,32}
- var bnb = {bna}
- var bnc = {bna}
- var bnd = {bna}
- #any diode output that disables wires (output tails)
- var ca = {16,20,24,28}
- var cb = {ca}
- var cc = {ca}
- var cd = {ca}
- #any output that enables wires (output heads)
- var ea = {14,18,22,26}
- var eb = {ea}
- var ec = {ea}
- var ed = {ea}
- #any on or head output
- var eea = {14,15,18,19,22,23,26,27}
- var eeb = {eea}
- var eec = {eea}
- var eed = {eea}
- #any input that disables substrate (input tails)
- var csa = {8,12}
- var csb = {csa}
- var csc = {csa}
- var csd = {csa}
- #any input that enables substrate (input heads)
- var esa = {6,10}
- var esb = {esa}
- var esc = {esa}
- var esd = {esa}
- #anything that makes counter flip: head inputs or substrate
- var essa = {6,10,30}
- var essb = {essa}
- var essc = {essa}
- var essd = {essa}
- #anything that is against counter flip: tail and off inputs or substrate
- var etta = {5,8,9,13,29,32}
- var ettb = {etta}
- var ettc = {etta}
- var ettd = {etta}
- #anything that is not essa or etta
- var ka = {0,1,2,3,4,6,7,10,11,12,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,30,31}
- var kb = {ka}
- var kc = {ka}
- var kd = {ka}
- #anything that is on or neutral for a wire tail: anything not an off/tail wire state or off diode output
- var na = {0,2,3,5,6,7,8,9,10,11,12,14,15,16,18,19,22,23,26,27,29,30,31,32}
- var nb = {na}
- var nc = {na}
- var nd = {na}
- #anything that is off or neutral for a wire head: anything not an on/head wire state or on diode output
- var ma = {0,1,4,5,6,7,8,9,10,11,12,13,16,17,20,21,24,25,28,29,30,31,32}
- var mb = {ma}
- var mc = {ma}
- var md = {ma}
- #same for substrate: not off/tail substrate or input state
- var nsa = {0,1,2,3,4,6,7,10,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,30,31}
- var nsb = {nsa}
- var nsc = {nsa}
- var nsd = {nsa}
- #same for substrate: not on/head substrate or input state
- var msa = {0,1,2,3,4,5,8,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,32}
- var msb = {msa}
- var msc = {msa}
- var msd = {msa}
- #any NON-input to outputs
- var naa = {0,1,2,3,4,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28}
- var nab = {naa}
- var nac = {naa}
- var nad = {naa}
- #any diode output
- var bba = {13,14,15,16}
- var bbb = {bba}
- var bbc = {bba}
- var bbd = {bba}
- #any XOR diode output
- var bbax = {21,22,23,24}
- var bbbx = {bbax}
- var bbcx = {bbax}
- var bbdx = {bbax}
- #any invertor output
- var cca = {17,18,19,20}
- var ccb = {cca}
- var ccc = {cca}
- var ccd = {cca}
- #any diode input
- var bbia = {5,6,7,8}
- var bbib = {bbia}
- var bbic = {bbia}
- var bbid = {bbia}
- #any invertor input
- var ccia = {9,10,11,12}
- var ccib = {ccia}
- var ccic = {ccia}
- var ccid = {ccia}
- #anything that is not an on/head output (anything but 14,15,18,19,22,23,26,27) [inverse of eea]
- var qa = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,16,17,20,21,24,25,28,29,30,31,32}
- var qb = {qa}
- var qc = {qa}
- var qd = {qa}
- #anything that is not an output and also not any wire
- var qqwa = {0,5,6,7,8,9,10,11,12,29,30,31,32}
- var qqwb = {qqwa}
- var qqwc = {qqwa}
- var qqwd = {qqwa}
- #anything that is not an on/head input
- var qqa = {0,1,2,3,4,5,8,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}
- var qqb = {qqa}
- var qqc = {qqa}
- var qqd = {qqa}
- #any substrate state
- var sa = {29,30,31,32}
- var sb = {sa}
- var sc = {sa}
- var sd = {sa}
- #substrate on or head
- var aaa = {30,31}
- var aab = {aaa}
- var aac = {aaa}
- var aad = {aaa}
- #any input on
- var ioa = {7,11}
- var iob = {ioa}
- var ioc = {ioa}
- var iod = {ioa}
- #### The actual rules ##########################################################
- #Important note: The order of the rules is of importance here: if a rule higher in the list applies, it overrides lower rules. Golly does this, possible other programs not.
- #output to wires. The one for turning on is first. Any head overrules any amount of tails. Any active diode/invertor output overrules tails too. Thanks to that, the 2- and 3-input OR and AND gates can be made.
- wa,ea,xa,xb,xc,2 #wire touching any output head become head
- 4,eea,xa,xb,xc,2 #wire tail touching on input becomes head instead. This allows long minecraft-style gates to work correctly (if flaky)
- wa,ca,qa,qb,qc,4 #wire touching diode/invertor/counter output tail but not any diode/invertor/counter output head/on becomes tail
- #regular wire states (1 is off, 2 is head, 3 is on, 4 is tail)
- 3,4,xa,xb,xc,4 #on touching tail becomes off
- 1,2,xa,xb,xc,2 #off touching head becomes head
- 2,4,ma,mb,mc,4 #head touching tail and no wire/output head/on becomes tail
- 2,xa,xb,xc,xd,3 #otherwise, head becomes on
- 4,2,na,nb,nc,2 #tail touching head and no wire/output tail/off becomes head
- 4,xa,xb,xc,xd,1 #otherwise, tail becomes off
- #input to substrate
- sa,esa,xa,xb,xc,30 #substrate touching any input head become head
- 32,ioa,xa,xb,xc,30 #substrate tail touching any on input gets converted into a head instead. That makes multiple outputs on even a long section of substrate act as OR (though flaky, requires settle time). It IS tail for one tick though, so can toggle a counter at this point (it can become tail if a neighboring substrate becomes tail)!
- sa,csa,qqa,qqb,qqc,32 #substrate touching input tail but not any input head/on becomes tail
- #regular substrate states (29 is off, 30 is head, 31 is on, 32 is tail)
- 31,32,xa,xb,xc,32 #on touching tail becomes off
- 29,30,xa,xb,xc,30 #off touching head becomes head
- 30,32,msa,msb,msc,32 #head touching tail and no substrate/input head/on becomes tail
- 30,xa,xb,xc,xd,31 #otherwise, head becomes on
- 32,30,nsa,nsb,nsc,30 #tail touching head and no substrate/input tail/off becomes head
- 32,xa,xb,xc,xd,29 #otherwise, tail becomes off
- #unconnected diode and invertor inputs serve as constant input of substrate tails or heads
- bbia,qqwa,qqwb,qqwc,qqwd,8 #diode input touching no wire/output goes to tail state
- ccia,qqwa,qqwb,qqwc,qqwd,10 #invertor input touching no wire/output goes to head state
- #diode input (5 is off, 6 is head, 7 is on, 8 is tail). Acts as xor.
- 5,oa,zb,zc,zd,6 #off and odd number of on inputs ==> head
- 5,oa,ob,oc,zd,6 #off and odd number of on inputs ==> head
- 6,oa,zb,zc,zd,7 #head and odd number of on inputs ==> on
- 6,oa,ob,oc,zd,7 #head and odd number of on inputs ==> on
- 6,ooa,zb,zc,zd,8 #head and even number of on inputs ==> tail
- 6,oa,ob,zc,zd,8 #head and even number of on inputs ==> tail
- 6,oa,ob,oc,od,8 #head and even number of on inputs ==> tail
- 7,ooa,zb,zc,zd,8 #on and even number of on inputs ==> tail
- 7,oa,ob,zc,zd,8 #on and even number of on inputs ==> tail
- 7,oa,ob,oc,od,8 #on and even number of on inputs ==> tail
- 8,ooa,zb,zc,zd,5 #tail and even number of on inputs ==> off
- 8,oa,ob,zc,zd,5 #tail and even number of on inputs ==> off
- 8,oa,ob,oc,od,5 #tail and even number of on inputs ==> off
- 8,oa,zb,zc,zd,6 #tail and odd number of on inputs ==> head
- 8,oa,ob,oc,zd,6 #tail and odd number of on inputs ==> head
- #invertor input (9 is off, 10 is head, 11 is on, 12 is tail). Acts as xor.
- 9,ooa,zb,zc,zd,10 #off and even number of on inputs ==> head
- 9,oa,ob,zc,zd,10 #off and even number of on inputs ==> head
- 9,oa,ob,oc,od,10 #off and even number of on inputs ==> head
- 10,ooa,zb,zc,zd,11 #head and even number of on inputs ==> on
- 10,oa,ob,zc,zd,11 #head and even number of on inputs ==> on
- 10,oa,ob,oc,od,11 #head and even number of on inputs ==> on
- 10,oa,zb,zc,zd,12 #head and odd number of on inputs ==> tail
- 10,oa,ob,oc,zd,12 #head and odd number of on inputs ==> tail
- 11,oa,zb,zc,zd,12 #on and odd number of on inputs ==> tail
- 11,oa,ob,oc,zd,12 #on and odd number of on inputs ==> tail
- 12,oa,zb,zc,zd,9 #tail and odd number of on inputs ==> off
- 12,oa,ob,oc,zd,9 #tail and odd number of on inputs ==> off
- 12,ooa,zb,zc,zd,10 #tail and even number of on inputs ==> head
- 12,oa,ob,zc,zd,10 #tail and even number of on inputs ==> head
- 12,oa,ob,oc,od,10 #tail and even number of on inputs ==> head
- #unconnected diode and invertor outputs serve as constant input of tails or heads ==> put a '12' next to a wire. Then you can in golly easily toggle this to high or low by toggling a '14' next to that wire (on another cell touching the same wire cell)
- bba,naa,nab,nac,nad,16 #diode output touching no inputs/substrate goes to tail state
- cca,naa,nab,nac,nad,18 #invertor output touching no inputs/substrate goes to head state
- #xor output that touches at least some wire (21 is off, 22 is head, 23 is on, 24 is tail, aa-ad is diode input on, bna-bnd is NOT diode input on). Acts as xor.
- 21,aa,wa,bnc,bnd,22 #off and odd number of on inputs ==> head
- 21,aa,ab,ac,wa,22 #off and odd number of on inputs ==> head
- 22,aa,wa,bnc,bnd,23 #head and odd number of on inputs ==> on
- 22,aa,ab,ac,wa,23 #head and odd number of on inputs ==> on
- 22,wa,bnb,bnc,bnd,24 #head and even number of on inputs ==> tail
- 22,aa,ab,wa,bnd,24 #head and even number of on inputs ==> tail
- 22,aa,ab,ac,ad,24 #head and even number of on inputs ==> tail
- 23,wa,bnb,bnc,bnd,24 #on and even number of on inputs ==> tail
- 23,aa,ab,wa,bnd,24 #on and even number of on inputs ==> tail
- 23,aa,ab,ac,ad,24 #on and even number of on inputs ==> tail
- 24,wa,bnb,bnc,bnd,21 #tail and even number of on inputs ==> off
- 24,aa,ab,wa,bnd,21 #tail and even number of on inputs ==> off
- 24,aa,ab,ac,ad,21 #tail and even number of on inputs ==> off
- 24,aa,bnb,wa,bnd,22 #tail and odd number of on inputs ==> head
- 24,aa,ab,ac,wa,22 #tail and odd number of on inputs ==> head
- #diode output that touches at least some wire (13 is off, 14 is head, 15 is on, 16 is tail, aa-ad is diode input on, bna-bnd is NOT diode input on). Acts as or.
- 13,aa,wa,xc,xd,14 #off and some number of on inputs ==> head
- 14,aa,wa,xc,xd,15 #head and some number of on inputs ==> on
- 14,wa,bnb,bnc,bnd,16 #head and no on inputs ==> tail
- 15,wa,bnb,bnc,bnd,16 #on and no on inputs ==> tail
- 16,wa,bnb,bnc,bnd,13 #tail and no on inputs ==> off
- 16,aa,xb,wa,xc,14 #tail and some on inputs ==> head
- #invertor output that touches at least some wire (17 is off, 18 is head, 19 is on, 20 is tail, aa-ad is diode input on, bna-bnd is NOT diode input on). Acts as nor.
- 17,wa,bnb,bnc,bnd,18 #off and no on inputs ==> head
- 18,wa,bnb,bnc,bnd,19 #head and no on inputs ==> on
- 18,aa,wa,xc,xd,20 #head and some on inputs ==> tail
- 19,aa,wa,xc,xd,20 #on and some on inputs ==> tail
- 20,aa,wa,xc,xd,17 #tail and some on inputs ==> off
- 20,wa,bnb,bnc,bnd,18 #tail and no on inputs ==> head
- #counter that touches at least some wire (note: counter ANDs its inputs)
- 25,essa,wa,kc,kd,26 #input heads w/o off/tail ==> flip state from off to head
- 28,essa,wa,kc,kd,26 #input heads w/o off/tail ==> flip state from tail to head
- 26,essa,wa,kc,kd,28 #input heads w/o off/tail ==> flip state from head to tail
- 27,essa,wa,kc,kd,28 #input heads w/o off/tail ==> flip state from on to tail
- #otherwise, counter tail/head flips to off/on state
- 26,xa,xb,xc,xd,27 #if none of the above, then head becomes on
- 28,xa,xb,xc,xd,25 #if none of the above, then tail becomes off
- #become head in inconsistent on-touching-off state
- 1,3,xa,xb,xc,2 #off wire touching an on wire: this is inconsistent state. To avoid requiring some of the required "warmup" of a circuit, become head.
- 29,31,xa,xb,xc,30 #idem for substrate
- ################################################################################
- ################################################################################
- ################################################################################
- ################################################################################
- @COLORS
- #background: black
- 0 0 0 0
- #wire: grey/white
- 1 128 128 128
- 2 192 192 192
- 3 255 255 255
- 4 96 96 96
- #diode input: blue
- 5 0 0 192
- 6 0 0 255
- 7 128 128 255
- 8 0 0 128
- #invertor input: orange
- 9 160 96 0
- 10 255 160 0
- 11 255 192 128
- 12 128 80 0
- #diode output: green
- 13 0 192 0
- 14 0 255 0
- 15 128 255 128
- 16 0 128 0
- #invertor output: red
- 17 128 0 0
- 18 255 0 0
- 19 255 128 128
- 20 96 0 0
- #xor output: yellow
- 21 160 160 0
- 22 192 192 0
- 23 255 255 0
- 24 140 140 0
- #counter output: magenta
- 25 192 0 192
- 26 255 0 255
- 27 255 128 255
- 28 128 0 128
- #substrate: cyan
- 29 0 160 160
- 30 0 192 192
- 31 0 255 255
- 32 0 128 128
- @ICONS
- XPM
- "7 224 2 1",
- " c #FFFFFF",
- ". c #000000",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- ".. ..",
- " ..... ",
- " ",
- " ",
- ". .",
- ".......",
- ".......",
- ".. ..",
- " ..... ",
- " ",
- " ",
- ". .",
- ".......",
- ".......",
- ".. ..",
- " ..... ",
- " ",
- " ",
- ". .",
- ".......",
- ".......",
- ".. ..",
- " ..... ",
- " ",
- " ",
- ". .",
- ".......",
- ".......",
- ".. ..",
- " ..... ",
- " ",
- " ",
- ". .",
- ".......",
- "... ...",
- ".. ..",
- " ..... ",
- " ",
- " ",
- ". .",
- ".......",
- "... ...",
- ".. ..",
- " ..... ",
- " ",
- " ",
- ". .",
- ".......",
- "... ...",
- ".. ..",
- " ..... ",
- " ",
- " ",
- ". .",
- ".......",
- "... ...",
- ".......",
- ".......",
- ". .",
- " ",
- " ",
- " ..... ",
- ".......",
- ".......",
- ".......",
- ". .",
- " ",
- " ",
- " ..... ",
- ".......",
- ".......",
- ".......",
- ". .",
- " ",
- " ",
- " ..... ",
- ".......",
- ".......",
- ".......",
- ". .",
- " ",
- " ",
- " ..... ",
- ".......",
- "... ...",
- ".......",
- ". .",
- " ",
- " ",
- " ..... ",
- ".......",
- "... ...",
- ".......",
- ". .",
- " ",
- " ",
- " ..... ",
- ".......",
- "... ...",
- ".......",
- ". .",
- " ",
- " ",
- " ..... ",
- ".......",
- "... ...",
- ".......",
- ". .",
- " ",
- " ",
- " ..... ",
- ".......",
- ".......",
- ".......",
- ". .",
- " ",
- " ",
- " ..... ",
- ".. ..",
- ".......",
- ".......",
- ". .",
- " ",
- " ",
- " ..... ",
- ".. ..",
- ".......",
- ".......",
- ". .",
- " ",
- " ",
- " ..... ",
- ".. ..",
- ".......",
- ".......",
- ". .",
- " ",
- " ",
- " ..... ",
- ".. ..",
- ".......",
- ". .",
- " .. ",
- " . ",
- " .. ",
- " ",
- ".......",
- ".......",
- ". .",
- " .. ",
- " . ",
- " .. ",
- " ",
- ".......",
- ".......",
- ". .",
- " .. ",
- " . ",
- " .. ",
- " ",
- ".......",
- ".......",
- ". .",
- " .. ",
- " . ",
- " .. ",
- " ",
- ".......",
- ". .",
- " ",
- " ",
- " ",
- " ",
- " ",
- ". .",
- ". .",
- " ",
- " ",
- " ",
- " ",
- " ",
- ". .",
- ". .",
- " ",
- " ",
- " ",
- " ",
- " ",
- ". .",
- ". .",
- " ",
- " ",
- " ",
- " ",
- " ",
- ". ."};
- XPM
- "15 480 2 1",
- " c #FFFFFF",
- ". c #000000",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- "...............",
- ". ........... .",
- ".. ......... ..",
- ". . . .",
- ". ......... .",
- ". .",
- ". .",
- ". .",
- ". .",
- ".. ..",
- "... ...",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- ". ........... .",
- ".. ......... ..",
- ". . . .",
- ". ......... .",
- ". .",
- ". .",
- ". .",
- ". .",
- ".. ..",
- "... ...",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- ". ........... .",
- ".. ......... ..",
- ". . . .",
- ". ......... .",
- ". .",
- ". .",
- ". .",
- ". .",
- ".. ..",
- "... ...",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- ". ........... .",
- ".. ......... ..",
- ". . . .",
- ". ......... .",
- ". .",
- ". .",
- ". .",
- ". .",
- ".. ..",
- "... ...",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- ". ........... .",
- ".. ......... ..",
- ". . . .",
- ". ......... .",
- ". .",
- ". .",
- ". .",
- ". .",
- ".. ..",
- "... ...",
- "....... .......",
- "...... . ......",
- "....... .......",
- "...............",
- "...............",
- ". ........... .",
- ".. ......... ..",
- ". . . .",
- ". ......... .",
- ". .",
- ". .",
- ". .",
- ". .",
- ".. ..",
- "... ...",
- "....... .......",
- "...... . ......",
- "....... .......",
- "...............",
- "...............",
- ". ........... .",
- ".. ......... ..",
- ". . . .",
- ". ......... .",
- ". .",
- ". .",
- ". .",
- ". .",
- ".. ..",
- "... ...",
- "....... .......",
- "...... . ......",
- "....... .......",
- "...............",
- "...............",
- ". ........... .",
- ".. ......... ..",
- ". . . .",
- ". ......... .",
- ". .",
- ". .",
- ". .",
- ". .",
- ".. ..",
- "... ...",
- "....... .......",
- "...... . ......",
- "....... .......",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "... ...",
- ".. ..",
- ". .",
- ". .",
- ". .",
- ". .",
- ". ......... .",
- ". ........... .",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "... ...",
- ".. ..",
- ". .",
- ". .",
- ". .",
- ". .",
- ". ......... .",
- ". ........... .",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "... ...",
- ".. ..",
- ". .",
- ". .",
- ". .",
- ". .",
- ". ......... .",
- ". ........... .",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "... ...",
- ".. ..",
- ". .",
- ". .",
- ". .",
- ". .",
- ". ......... .",
- ". ........... .",
- "...............",
- "...............",
- "...............",
- "...............",
- "....... .......",
- "...... . ......",
- "....... .......",
- "... ...",
- ".. ..",
- ". .",
- ". .",
- ". .",
- ". .",
- ". ......... .",
- ". ........... .",
- "...............",
- "...............",
- "...............",
- "...............",
- "....... .......",
- "...... . ......",
- "....... .......",
- "... ...",
- ".. ..",
- ". .",
- ". .",
- ". .",
- ". .",
- ". ......... .",
- ". ........... .",
- "...............",
- "...............",
- "...............",
- "...............",
- "....... .......",
- "...... . ......",
- "....... .......",
- "... ...",
- ".. ..",
- ". .",
- ". .",
- ". .",
- ". .",
- ". ......... .",
- ". ........... .",
- "...............",
- "...............",
- "...............",
- "...............",
- "....... .......",
- "...... . ......",
- "....... .......",
- "... ...",
- ".. ..",
- ". .",
- ". .",
- ". .",
- ". .",
- ". ......... .",
- ". ........... .",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "... ...",
- ".. ..",
- ". .",
- ". .",
- ". .",
- ". .",
- ". ......... .",
- ". . . .",
- ".. ......... ..",
- ". ........... .",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "... ...",
- ".. ..",
- ". .",
- ". .",
- ". .",
- ". .",
- ". ......... .",
- ". . . .",
- ".. ......... ..",
- ". ........... .",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "... ...",
- ".. ..",
- ". .",
- ". .",
- ". .",
- ". .",
- ". ......... .",
- ". . . .",
- ".. ......... ..",
- ". ........... .",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "... ...",
- ".. ..",
- ". .",
- ". .",
- ". .",
- ". .",
- ". ......... .",
- ". . . .",
- ".. ......... ..",
- ". ........... .",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "... ...",
- ".. ... ..",
- ". . .",
- ". . .",
- ". . .",
- ". . .",
- ". ... .",
- ". .",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "... ...",
- ".. ... ..",
- ". . .",
- ". . .",
- ". . .",
- ". . .",
- ". ... .",
- ". .",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "... ...",
- ".. ... ..",
- ". . .",
- ". . .",
- ". . .",
- ". . .",
- ". ... .",
- ". .",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "...............",
- "... ...",
- ".. ... ..",
- ". . .",
- ". . .",
- ". . .",
- ". . .",
- ". ... .",
- ". .",
- "...............",
- "...............",
- "...............",
- ".. ..",
- ". .",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- ". .",
- ".. ..",
- ".. ..",
- ". .",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- ". .",
- ".. ..",
- ".. ..",
- ". .",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- ". .",
- ".. ..",
- ".. ..",
- ". .",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- ". .",
- ".. .."};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement