Warpdrive

From Esolang
Jump to navigation Jump to search

Warpdrive is a language created by User:Aithecomputerguy that is very loosely based off of cellular automata. Its name comes from the idea of going faster than the speed of light, which in cellular automata is faster than one cell per tick and in traditional cellular automata is impossible. It consists of an infinite one dimensional array of cells with unique identifiers. On each tick, cell N may "activate" another cell depending on how many cells activated cell N on the previous tick.

Language description

Every statement describes the behavior of a cell:

STATEMENT := CELL_NUM: SINGLE_1, SINGLE_2, ..., SINGLE_N ! MULTI_1, MULTI_2, ..., SINGLE_N;

where CELL_NUM is a unique case-sensitive string that identifies the cell (characters :,! and ; are not allowed), SINGLE_1, SINGLE_2, etc. are cell identifiers to activate when this cell is activated by exactly one other cell, and MULTI_1, MULTI_2, etc. are cell identifiers to activate when this cell is activated by more than one other cell on the previous tick. In each statement, CELL_NUM and the symbols :; are required, but nothing else is. If a cell doesn't have a corresponding statement or has an empty statement associated with it, it does nothing upon activation.

Comments are designated with # and continue until a newline is reached.

Upon starting, each statement is interpreted and stored in a usable format (implementation specific). Cell zero is then activated.

Examples

Half adder. In this example, it adds 1+1 by calling A_1 and B_1 simultaneously. Either Out_0 or Out_1 will be activated depending on the inputs. Likewise and simultaneously, Carry_0 or Carry_1 will be activated. OutXor takes two ticks to complete, so CarryDelay is required.

0: A, B;
A: A_1;
B: B_1;

# The half-adder.
A_0: OutXor_0, CarryAnd_0;
A_1: OutXor_1, CarryAnd_1;

B_0: OutXor_0, CarryAnd_0;
B_1: OutXor_1, CarryAnd_1;

OutXor_0: OutXor2_1 ! OutXor2_0;
OutXor_1: OutXor2_1 ! OutXor2_0;

OutXor2_0: Out_0 ! Out_0;
OutXor2_1: Out_1 ! Out_0;

CarryAnd_0: CarryDelay_0;
CarryAnd_1: !CarryDelay_1;

# Output
Out_0:;
Out_1:;

CarryDelay_0:Carry_0;
CarryDelay_1:Carry_1;
Carry_0:;
Carry_1:;

Computational class

The ability to create both AND and XOR gates proves this language is able to represent any Bounded-storage machine but as it is not possible to access any cell not explicitly specified in the original program it is not Turing-complete.