Photon World

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

Photon World is a Turing-complete set of building blocks invented by the author. You can study the given 50 logical gadgets and tools or design your own programs.

[more]

The red and yellow mirrors can be used as stored digital data (yes/no information).

[less]

Contributed by: Karl Scherer (March 2016)
Open content licensed under CC BY-NC-SA


Snapshots


Details

Introduction

In "Photon World" special particles called "photons" travel along straight lines until they hit a mirror, a junction/splitter, a delay, or a wall. For clarity it is recommended that you keep the photons at least one position apart (in direction of movement).

When a photon hits (either side of) a mirror, it is deflected at a right angle. Green mirrors are fixed and are unaffected by incoming photons. However, if a photon hits a "flip-flop" mirror (red or yellow), the mirror rotates by 90° after the photon hits it.

The junction/splitter is best described with the tip pointing up: • When a photon hits one of the two small sides of the blue triangle of a junction, it is reflected the same as a mirror. • When a photon hits the blue triangle from the top, it is split into two photons, one heading left and one heading right, with no photon going right through the junction/splitter. • When a photon hits the blue triangle from the bottom, it passes right through. • When two photons hit the two short slopes of the blue triangle of a junction/splitter, a single photon is emitted from the tip of the triangle. • When a photon arrives at a delay, it stays there for one step before it moves on. • When a photon arrives at a wall, the photon is annihilated.

Drawing modes

As described below (under "Controls"), clicking a mirror icon or similar at the left border puts you in "drawing mode", which means that new tiles are put down wherever you click the main board. Note that the drawing modes do NOT trigger any screen shots that you can go back to with the "back" button. To create a screen shot at any time, click the "screen shot" button.

Lines and crosses

Lines and crosses can be used to mark the path a photon travels. Their use is optional.

Automatic elimination of photons

If two photons move to the same position, they are annihilated. Hence, you cannot have one photon hit one side of a mirror and a second photon hit the other side of a mirror at the same time. There is one exception: when two photons hit the two short slopes of the blue triangle of a junction/splitter, a single photon is emitted from the tip of the triangle.

Completeness

"Photon World" is "Turing complete", which means that any sequentially working computer can be realized within "Photon World". Actually, any set of gadgets (mechanical, electric, or electronic) that includes an NAND gate is Turing complete!)

Similar to "electrons" in "Wire Word" or the "trains" in "Train Set", in "Photon World" special particles called "photons" do all the processing.

Controls

challenge: Click "challenge" or use "</>>" to go to another sample setup.

screen shot: Click to save the current board setup. Use "back" to play all screen shots back.

run: The "run" buttons will move all existing photons by 1, 5, 10, 30, or 100 steps.

clicks: The "clicks" counter counts how many "run" keys, "shift" keys, or screen shots you have clicked. Each such click stands for a board position you can go back to by clicking the "back" button (e.g. "run 100" creates only one click!)

back: takes you back to the last stored screen shot.

steps moved by photons: This counter accumulates all move steps done by the photons. It does NOT count "shift" commands.

trace: If "trace" is selected, the photons will leave a trace (orange lines) wherever they move over unoccupied board positions. Click again to switch the trace mode off.

photons: Click it to go into "draw photons" mode, then click the board to draw a photon. Click the same board position repeatedly to rotate the photon by 90 °, 180°, or 270°, or to delete any tile on this position.

diagonal fixed mirror: Click it to go into "draw diagonal fixed mirror" mode, then click the board to draw the mirror. Click the same board position repeatedly to rotate the mirror by 90 °. Both mirror types have green backgrounds.

diagonal flip-flop mirror: Click it to go into "draw diagonal flip-flop mirror" mode, then click the board to draw the mirror. Click the same board position repeatedly to rotate the mirror by 90 °. The mirrors have red and yellow backgrounds.

junction/splitter Click it to go into "draw junction/splitter" mode, then click the board to draw a junction/splitter. Click the same board position repeatedly to rotate the junction/splitter by 90 °, 180°, or 270°, or to delete any tile on this position. A junction/splitter consists of a blue triangle on a green background.

line: Click it to go into "draw lines" mode, then click the board to draw a line of unit length. Click the same board position repeatedly to rotate the line by 180°, show a cross (intersection of two lines), or delete any tile on this position.

delay: Click it to go into "draw delays" mode, then click the board to draw a delay (purple square). Click the same board position again to delete any tile on this position.

wall: Click it to go into "draw wall" mode, then click the board to draw a wall (black square). Click the same board position again to delete any tile on this position.

shift and shift type: This tool helps you with setting up or editing the board.

If shift type is "all", click one of the four buttons to shift the board content to the left, up, down, or right.

If shift type is "h/v line", click the buttons with the "left/right" arrows to shift the current file to the left or right; click the buttons with the "up/down" arrows to shift the current row of the board setup up or down. The "current" row or file is the one clicked last.

If shift type is "P", the last clicked board position is shifted

delete mode: This "delete mode" also helps you with setting up or editing the board. Click to enter the "delete mode". Click any board position to delete any tile on this position.

clear: Click to clear the board.

show photons: Click to hide/show the photons on the board.

board position: shows the coordinates {x,y} of the last clicked board position, 0<=x,y<=25.

History

"Photon World" was first published by the same author as the Zillions game "Photon World" in 2003. The Zillions game had a slightly different design.

Challenges: descriptions and comments

"Clocks and blocks" Click the run button to see the photon guns (clocks) in action. From top to bottom they shoot at frequency 1, 2, 3, 4, and 5. Data streams of frequency 1, though very compact, have the disadvantage that they cannot cross each other.

Three types of blocks are shown to the right. Blocks catch photons. We see that the black square as block is actually redundant; a block can be built from: • three mirrors and one junction • four mirrors and a junction • four junctions

However, we will mostly use the black square block in our variants because it keeps our constructions simple and saves space.

"Frequency doubler" Click the run button to see the 4-cycle photon gun (clock) in action. The clock shoots at a gadget that serves as a frequency doubler: for each photon, a twin is created that trails the photon by 2 units. Further down the track, a second frequency doubler turns the 2-cycle photon stream into a 1-cycle photon stream.

"Reflectors" Click the run button. The double reflector shown on the left side works for photons coming in from either the north or south direction. The reflector delays the photons by 6 ticks.

The setup on the right shows reflectors (designed by Greg Schmidt) that only work for photons coming in from one direction. These reflectors delay the photon by 4 ticks.

"On/Off bulb" Click the run button. The "bulb" (the red flip-flop-mirror) toggles between red and yellow when a photon passes through.

"Delays" Click the "run 6" button three times. Three identical data streams are created by the three clocks at the left. The top stream travel is undisturbed. The center stream is delayed by one tick. The bottom stream is delayed by two ticks. In this case, a set of four fixed mirrors creates a 2-tick delay.

"Crossing" Click the run button. The two data streams cross each other without interference because they are out of step. This demonstrates that in Photon World no special gadgetry is necessary for crossings as long as the data streams are kept out of step. This greatly helps to keep our constructions simple.

"Logical gates: Diode (one-way gate)" Click the run button. A junction in combination with two blocks works as a diode.

"Logical gates: OR" Click the run button. The junctions work as OR gates. Note that these OR gates can have up to three input lines.

"Logical gates: NOT" Click the run button. When two photons collide in free space, they will be eliminated. With this we build a simple NOT(A) gate. Here data stream A is the one coming from the bottom. A clock of frequency two is used at the top.

The data stream exiting to the right represents NOT(A). This means that it contains a photon if and only if there is no photon coming from A.

"Logical gates: ANDNOT" Click the run button. When two photons collide in free space they will be eliminated. With this we build a simple ANDNOT(A,B) gate. Here data stream A is the one entering from the top and B the one entering from the left.

The data stream finally heading south is ANDNOT(A,B). This means that it contains a photon whenever there is a photon coming from A, but not from B.

"Logical gates: AND" Click the run button. The AND gate outputs a photon only if there is a photon coming from both inputs simultaneously.

Here we used two ANDNOT gates to build the AND gate: AND(A,B) = ANDNOT(A,(ANDNOT(A,B)). Data stream A is the one on the top.

"Logical gates: NAND" (NOT And): Click the run button. We could build a NAND gate from a NOT And and AND gate NAND(A,B) = NOT(AND(A,B), but the construction shown here is much simpler. It uses the fact that NAND(A,B) = OR (NOT(A), NOT(B)).

"Logical gates: XOR" Click the run button. The XOR gate outputs a photon if and only if there is a photon coming both from either input line, but not from both simultaneously.

Note the extreme simplicity of the gate: it uses only three elements: two mirrors and a junction.

"3-cycle dual-input flip-flop" In dual-input flip-flops, the start and stop signals arrive on separate tracks.

Click the run button. Watch how the 6-cycle clock containing two photons is switched on and off by the incoming photons. Note that the photons must be synchronized; they must have a delay between them of a multiple of 3.

Restriction: In this setup, a stop signal may only be sent when the flip-flop is ON. A dual-input flip-flop is also called an RS-latch (set/reset latch). The one shown here is "set-dominant", which means that the flip-flop will be switched on if the set and reset lines are active (carry a bit) at the same time.

"4-cycle dual-input flip-flop" Dual-input flip-flops are the simplest flip-flops in Photon World. The start and stop signals arrive on separate tracks.

Click the run button. Watch how the two 4-cycle clocks are switched on and off by the incoming photons. Note that the incoming photons must be synchronized; they must have a delay between them of a multiple of 4.

"5-cycle dual-input flip-flop" In dual-input flip-flops, the start and stop signals arrive on separate tracks.

Click the run button. Watch how the 10-cycle clock containing two photons is switched on and off by the incoming photons. Note that the photons must be synchronized; they must have a delay between them of a multiple of 5.

Restriction: In this setup, a stop signal may only be sent when the flip-flop is ON.

"6-cycle dual-input flip-flop" Dual-input flip-flops are the simplest flip-flops in Photon World. The start and stop signals arrive on separate tracks.

Click the run button. Watch how the 6-cycle clock is switched on and off by the incoming photons. Note that the photons must be synchronized; they must have a delay between them of a multiple of 6.

A dual-input flip-flop is also called an RS-latch (set/reset latch). The one shown on the right side here is "set dominant", which means that the flip-flop will be switched on if the set and reset lines are active (carry a bit) at the same time. The one shown on the left side here is "reset dominant", which means that the flip-flop will be switched off if the set and reset lines are active (carry a bit) at the same time.

"3-cycle flip-flop" Click the run button. Watch how the 3-cycle flip-flop is switched on and off by the incoming photons.

The flip-flop uses a 6-cycle photon gun that contains two photons. The photons in this gun circuit have a delay of 3 ticks between them. The two photons are simultaneously created by one incoming photon and simultaneously deleted by the next incoming photon. This basic principle can be used for many flip-flops. However, in general it may not produce the smallest flip-flops.

"4-cycle flip-flop" Click the run button. Watch how the 4-cycle flip-flops are switched on and off by the incoming photons.

The flip-flop on the left has been constructed from two 8-cycle flip-flops, which have a 4-cycle delay between them. The flip-flop on the left has been constructed using two photons running in one 8-cycle loop, the photons having a 4-cycle delay between them. The two photons are simultaneously created by one incoming photon and simultaneously deleted by the next incoming photon.

"5-cycle flip-flop" Click the run button. Watch how the 5-cycle flip-flop is switched on and off by the incoming photons.

The flip-flop uses a 10-cycle photon gun that contains two photons. The photons in this gun circuit have a delay of 5 ticks between them. The two photons are simultaneously created by one incoming photon and simultaneously deleted by the next incoming photon. This basic principle can be used for many flip-flops. However, in general it does not produce the smallest flip-flops.

"6-cycle flip-flop" Click the run button. Watch how the 6-cycle clock is switched on and off by the incoming photons.

"6-cycle flip-flop without moving mirror" Click the run button. Watch how the 6-cycle clock is switched on and off by the incoming photons.

Note how much more complicated this construction is (because we avoided using a moving mirror) compared to the flip-flop in the previous variant.

Here is how it works in detail: • The incoming photon is split into two parallel ones. • The top photon triggers the start of a 6-cycle flip-flop. • The one beneath stops the clock by colliding with the circulating photon. • When the flip-flop is not active, the second photon is stopped from eliminating its twin; this is done by a photon emitted by a permanent 6-cycle clock, seen on the lower right.

Once the flip-flop is up and running, it not only emits photons to the right, but also emits one to the bottom. This second photon then collides with the flip-flop photons, thereby rendering the temporary clock inactive and thus allowing the incoming twin to stop the flip-flop cycle. Hence, we have three data streams stopping each other: clock output stops twin, twin stops flip-flop cycle, flip-flop output stops clock output.

"6-cycle flip-flop built from junctions only" Click the run button. Watch how the 6-cycle clock is switched on and off by the incoming photons.

This flip-flop is basically the same as in the previous variant. However, we have replaced all mirrors and blocks with J-elements. This proves that the junction/splitter is the only type of element we really need to build a flip-flop, and hence the only one we need to build all elements of a computer. We will see in another variant further down how we can simulate a flip-flop mirror using only J-elements.

"8-cycle flip-flop" Click the run button. Watch how the 8-cycle clock is switched on and off by the incoming photons.

"8-cycle flip-flop without moving mirror" Click the run button. Watch how the 8-cycle clock is switched on and off by the incoming photons.

Note how much more complicated this construction is (because we avoided using a moving mirror) compared to the flip-flop in the previous variant.

Here is how it works in detail: • The incoming photon is split into two parallel ones. • The top photon triggers the start of the 8-cycle flip-flop. • The one beneath stops the flip-flop by colliding with the circulating photon. • When the flip-flop is not active, the second photon is stopped from eliminating its twin; this is done by a photon emitted by the 8-cycle clock, seen on the lower right.

Once the flip-flop is up and running, it not only emits photons to the right, but also emits one to the bottom. This second photon then collides with the clock photons, thereby rendering the clock inactive and thus allowing the incoming twin to stop the flip-flop cycle. Hence, we have three data streams stopping each other: clock output stops twin, twin stops flip-flop cycle, flip-flop output stops clock output.

"8-cycle flip-flop built from junctions only" Click the run button. Watch how the 8-cycle clock is switched on and off by the incoming photons.

This flip-flop is basically the same as in the previous variant. However, we have replaced all mirrors and blocks with J-elements. This proves that the junction/splitter is the only type of element we really need to build a flip-flop, and hence the only one we need to build all elements of a computer. We will see in another variant further down how we can simulate a flip-flop mirror using only J-elements.

"Even/Odd detector" Click the run button. The top loop emits series of two photons, the bottom one series of three photons. We see that the even/odd detector to the right releases a photon (namely the last photon of the series) if and only if the data stream contained an even number of photons.

"Positive edge detector" Click the run button. A negative edge detector emits a photon whenever the last photon of a series of photons arrives. A delayed signal interferes with the original data stream to create the desired result.

"Negative edge detector" Click the run button. The top clock creates a 2-cycle data stream 11100001110000… , the bottom one a 4-cycle data stream 11001100… . The negative edge detectors at the right emit a photon whenever the last photon of a series of photons arrives. Note that this signal is delayed by 2 (respectively 4) ticks. The original signal interferes with a delayed twin to create the desired result.

"Double edge detector" Click the run button. A (double) edge detector emits a photon either when the first or after the last photon of a series of photons arrives. Note that the second signal is delayed.

We have built the edge detector by XORing the data stream with a delayed copy of itself. Note that the construction incorporates a position where two beams cross each other without interference.

"Flip-flop mirror (6-cycle) built from other elements" Flip-flop mirror, also called a data-driven multiplexer.

Click the run button. Watch how the (6-cycle) input data is redirected to the top and to the bottom alternately. The technical term for such an element is a "multiplexer". This shows that we can simulate a flip-flop mirror from the other building elements. The only restriction is that the incoming photons have a distance from each other that is a multiple of 6.

"Flip-flop mirror (6-cycle) built from junctions only" Flip-flop mirror, also called a data-driven multiplexer.

Click the run button. Watch how the (6-cycle) input data is redirected to the top and to the bottom alternately. This shows that we can simulate a flip-flop mirror from the other building elements. The only restriction is that the incoming photons have a distance from each other that is a multiple of 6.

"Flip-flop mirror (8-cycle) built from other elements" Flip-flop mirror, also called a data-driven multiplexer.

Click the run button. Watch how the (8-cycle) input data is redirected to the top and to the bottom alternately. This shows that we can simulate a flip-flop mirror from the other building elements. The only restriction is that the incoming photons have a distance of each other that is a multiple of 8.

Of course we can create a similar setup that uses J-elements only, omitting the block and mirror elements. I leave this as a task for the reader.

"Parallel to serial converter" Click the run button. Parallel input wires carry photons that represent 1/2/4/8 bits of data. Design by Greg Schmidt.

"Simple multiplexer" A multiplexer directs the incoming data stream to one of two output lines. A simple multiplexer has no external control signal. Every few cycles (here every 4 cycles) it directs any incoming data to another output wire.

Click the run button. The data stream is entering from the top. Watch how the data is distributed every 4 cycles to another of two output lines.

Technical description: The circuit contains two 4-cycle loops, one delayed by 2 ticks, which trigger two ANDNOT gates.

"Dual-input multiplexer" A multiplexer directs the incoming data stream to one of two output lines. Signals separate from the data stream control which of the output lines the data stream is directed to. The chosen direction stays the same until the next control signal arrives. In the dual-input version of a multiplexer, these control signals arrive on separate lines.

Click the run button. Here we present a multiplexer for 6-cycle data. The data stream is entering from the bottom. First it is directed to the left, later to the right, and finally it keeps going to the left. These actions are triggered by control signals entering the multiplexer on separate input lines. Note: it is allowed that one of these control lines carries several signals in a row.

Technical description: The circuit contains two 6-cycle flip-flops, only one of which is active at any time. One flip-flop blocks the output to the left, the other the output to the right. The incoming signal starts one flip-flop and—via a beam splitter—simultaneously stops the other flip-flop.

"Mono-input multiplexer I" A multiplexer directs the incoming data stream to one of two output lines (here left and right). Signals separate from the data stream control which of the output lines the data stream is directed to. The chosen direction stays the same until the next control signal arrives. In the mono-input version of a multiplexer, these control signals arrive on the same line.

Here we present a multiplexer for 6-cycle data. Click the run button. The data stream is entering from the bottom. First it is directed to the left, later to the right, and finally it keeps going to the left. These actions are triggered by control signals entering the multiplexer from above. Note that each incoming signal changes the direction of the outgoing data stream.

Technical description: The circuit contains two 6-cycle flip-flops, only one of which is active at any time. One flip-flop blocks the output to the left, the other the output to the right. The incoming signal starts one flip-flop and—via a beam splitter—simultaneously stops the other flip-flop. An alternating mirror takes care that the next signal starts and stops the opposite flip-flops.

"Mono-input multiplexer II" A multiplexer directs the incoming data stream to one of two output lines (here left and right). Signals separate from the data stream control which of the output lines the data stream is directed to. The chosen direction stays the same until the next control signal arrives. In the mono-input version of a multiplexer, these control signals arrive on the same line.

Click the run button. Here we present a multiplexer for 6-cycle data. (Note its small area of only 5x7!) The data stream is entering from the top right. The control data enters from the top left. Note how it changes the direction of the outgoing data stream.

Technical description: The circuit uses an alternating mirror, which directs the oncoming data to the left and right output. Each incoming photon gets a twin attached to it (2 ticks behind it) that resets the alternating mirror. Hence, the data bits actually all go in one direction. The twins are eliminated by a 6-cycle clock when they leave the multiplexer.

The control signal (top left) flips the alternating mirror and thus flips the direction of the outgoing data. Note that the control signal must be timed 4 ticks after the 6-cycle clocking. The control signal is eliminated when it leaves the multiplexer.

"Dual-input demultiplexer" A demultiplexer directs one of two incoming data streams to one output line. Signals separate from the data stream control which of the input data streams is chosen. The chosen direction stays the same until the next control signal arrives. In the dual-input version of a multiplexer, these control signals for "left" and "right" arrive on separate lines. This has the advantage that several "left" commands can be sent without a "right" signal in between (application: binary adder).

Here we present a demultiplexer for 6-cycle data. Note that the demultiplexer is very similar to one of the multiplexers we presented before (see other variant).

"Mono-input demultiplexer" A demultiplexer directs one of two incoming data streams to one output line. Signals separate from the data stream control which of the input data streams is chosen. The chosen direction stays the same until the next control signal arrives. In the mono-input version of a multiplexer, these control signals for "left" and "right" arrive on the same line.

Here we present a demultiplexer for 6-cycle data. Note that the demultiplexer is identical to the multiplexer (see other variant).

"Binary Adder" Of course a binary adder is possible in Photon World. Click the run button. At the top left the number A = '11' (=3) enters the adder, with the lowest digit first. Similarly, at the top right the number B = '111' (= 7) enters the adder. We will see the number C = '1010' leaving the adder, with the lowest digit first. In order to see where the number C starts, we have A running parallel to it at the right border when the result comes out. Black squares have been added to indicate the positions of the digits. The setup in principle can take numbers of any size (you would have to extend the incoming lines for this).

Technical description: Bit by bit, the input data is XORed: Ci = XOR(Ai,Bi). When a bit is found in both data streams at the same time (AND(Ai),(Bi) = true), the system switches to Ci = XOR(NOT(Ai),Bi) from the next bit onward. It stays in this mode until a zero is found in both A and B (we check AND(NOT(Ai),NOT(Bi)) = true). Then the system switches back to XOR(Ai, Bi) from the next bit onward. The switch between the two XOR modes is executed via a so-called double-input demultiplexer (see associated variant).

"Binary Adder II" Here the data is represented by mirrors, and a single photon does all the processing. (Compare the binary adder in the Zillions game "Train Set"!)

The mirrors representing the data are neatly placed on top of each other. At the bottom (yellow, red, red) we see input 011 = 3; the middle shows 101 (red, yellow, red) = 5. We could also use fixed mirrors for this data, but the flip-flop mirrors stand out more. The top line will show 1000 (red, yellow, yellow, yellow) at the end, with the highest digit in the top-left corner. (The two input numbers are changed in the process, but that can be avoided by using fixed mirrors, as mentioned above.) In order to take larger input numbers, this setup has to be enlarged by the same area for each additional digit. Remember that the previous adder does not have this requirement.

Technical description: Bit by bit, the input data is checked: for each 1, the mirror at the top is flipped. If it is set to "left", then the photon undergoes an additional travel step to the result bit to the left and flips this mirror as well.

The biggest design problem here is that the resulting bits must be able to be written from two different circuits. Note how that is done by having parts of the circuit shared, but the photon is running in the opposite direction in the second loop, which allows using separate entrances and exits for the two cases. The same trick has been used in the binary adder of the "Train Set" game.

"Fun: Mainspring" Click the run button. A single photon spirals its way toward the center and then back the same way. A little fun thing by Greg Schmidt.

"Fun: Distributor" Click the run button. A single photon splits into many parallel ones and then joins all to one photon again. A little fun thing by Greg Schmidt.



Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.
Send