Not The Main Worb

From Esolang
Jump to: navigation, search
Not The Main Worb
Paradigm(s) particle automaton
Designed by User:Quintopia
Appeared in 2014
Computational class Finite state automaton
Reference implementation None
Influenced noit o' mnain worb
File extension(s) .ntm


Not The Main Worb is a 2014 cellular automaton derived by User:Quintopia from Chris Pressey's Noit o' mnain worb (nomw) and inspired by User:ais523. It simultaneously enriches and simplifies the original automaton, making wire-crossings and amplifiers possible.

States

There are six possible states in a Not The Main Worb (NTMW) program:

  • Bobule
  • Hole
  • Transmitter/Bobule
  • Transmitter/Hole
  • Receiver/Bobule
  • Receiver/Hole

Every Transmitter cell or Receiver cell has a label. Any Transmitters and Receivers that have the same label are associated with one another. The number of labels available is implementation-dependent, but could be unbounded. As such, counting differently labeled states as different states, the NTMW automaton may have infinitely many possible states.

Transition Function

At every step in a NTMW program, cells in states Bobule or Receiver/Bobule swap their Bobule/Hole attribute with a randomly selected neighbor in their Moore neighborhood (including themselves). Intuitively, then, Bobules swap into a random adjacent cell (or not) in each step.

Any time a Transmitter/Hole cell becomes a Transmitter/Bobule cell, it will remain in that state until all other Transmitter cells with the same label also become Transmitter/Bobule. In other words, Bobules stick to Transmitters until all associated Transmitters have a Bobule on them. Likewise, any time a Receiver/Bobule becomes a Receiver/Hole, it remains in that state until all other Receivers with the same label become Receiver/Hole. When both of these conditions are satisfied for a given label, all Transmitter/Bobules with that label become Transmitter/Holes, and all Receiver/Holes with that label become Receiver/Bobules. Intuitively, when all associated Transmitters are filled with Bobules, and all associated Receivers are free, the Bobules are all consumed and the Receivers all produce Bobules.

It should be clear that these two types of state transition (which fully define the transition function of NTMW) are PT-symmetic: reversing time in the automaton is the same as switching Bobules with Holes.

Representation

It would be quite impractical and unintuitive to represent an NTMW initial state map using one character per cell due to the possibility, say, of a Transmitter having any of a large number of labels while also either having or not having a Bobule on it. However, using an image representation would be quite intuitive. Let each pixel be a cell. Let the red component be the label (where zero means "not a Transmitter or Receiver"), the MSB of the green component be the Transmitter (on) or Receiver (off) state attribute, and the MSB of the blue component be the Bobule (on) or Hole (off) attribute. Thus, our original six states will appear mostly:

  • Bobule = blue
  • Hole = black
  • Transmitter/Bobule = cyan to white
  • Transmitter/Hole = green to yellow
  • Receiver/Bobule = blue to purple
  • Receiver/Hole = black to red

In addition, although this language has no specified equivalent of nomw's Load Indicator, if an implementation should want to include such a feature for testing or output purposes (for instance, use it to increment a counter to see how many Bobules used a particular Transmitter), the second-to-most significant bit of the green component would make a fine selector bit for this purpose.

Walls

The equivalent of nomw's walls can be achieved by using Receiver/Holes (or Transmitter/Bobules) with one associated Transmitter/Hole which is entirely separated from all Bobules. Indeed, all walls in a given program can use the same label. To this end, an implementation of NTMW may treat all programs as if they were embedded in a infinite plane filled with Transmitter/Bobule all of which have the maximum possible label (or a special 'positive infinity' label in unbounded implementations).

Half-walls

The equivalent of nomw's half-walls/one-way cells can be achieved by placing a Transmitter directly adjacent to its associated Receiver. Every such pair requires a unique label to be used for this purpose.

Sources and Sinks

If a Transmitter (or set of associated Transmitters) has no associated Receivers, the condition on the Receivers for the transition function is trivially fulfilled, and it will immediately consume any Bobule that lands on it (or consume all Bobules which land on all of them when they are all filled). In other words, it behaves exactly like one of nomw's sinks. Likewise, Receivers with no associated Transmitter behave like nomw's sources.

Wire-crossing

The Transmitter/Receiver pairs need not be adjacent, though. One can put them on opposite sides of several walls. It should be obvious how to use this to create two perpendicular and crossing flows of Bobules.

Amplifiers

The number of Transmitters with a given label need not equal the number of Receivers with that label. If one associates one Transmitter with two Receivers, one can readily amplify the number of Bobules in a stream.

Logic Gates

One can construct logic gates in NTMW, using pairs of "wires" (lanes lined by walls), one of which contains Bobules (True) and its complement, which does not (False).

  • OR: Combine two wires into a third wire with a half-wall at the end of each. AND their complements.
  • AND: End two wires with Transmitters and begin a third wire with their associated Receiver. OR their complements.
  • NOT: Swap a wire with its complement, using a Transmitter and a Receiver in each.

All other logic gates can be constructed from combinations of these three, which means any boolean circuit can be constructed using these plus various sources, sinks, and wire crossings. This implies that one can construct PSPACE-complete families of NTMW programs.