Blind is an esoteric programming language designed by Keymaker in 2011 (although the idea was conceived in 2010). The language is based on two-dimensional pattern-matching, and is Turing-complete.
The pattern-matching occures on an infinite field which may be thought as a grid, where each cell is of certain space. There are two types of space, unrecognized and recognized. Initially every cell is unrecognized, and the initial structure will be placed roughly in the center of the field. The placement of course does not matter, the space being limitless to every direction no matter where the placement occures.
The pattern-matching happens with structures, which are shapes that hold in itself both the pattern that is to be matched on the field, and the instructions to modify the field (upon a match). On every cycle (beginning with cycle 0), first the field is draw (if using a visual interpreter), and then pattern-matching occures. The first structure (the one following the initial structure in the program file) is taken. The entire field is inspected, left to right, downwards from the top. If there is no match, the next structure is inspected. If no structure matches, then nothing happens -- the program never terminates, the field will simply remain unchanged from that cycle onwards.
It might be the best to introduce a simple program.
111...111.111 1.1...111.1.1 111...111.111 ............. ......111.... ......1.1.... ......111.... .....xxx .....xxx .....xxx ..*..... .*.*.*** *...**** .*.*.*** ..*..... xxx x..
This program has three elements; the initial structure (13x7), and two structures, with dimensions 8x8 and 3x2 respectively. The initial structure consist of characters '.' and '1'. '.' marks unrecognized space, and '1' marks recognized space (but only in the initial structure). The structures have to be rectangles, each line (in the given structure) must have the same amount of cells. All structures must be separated from each other by two new-lines, that is, an empty line. Spaces are allowed anywhere on the lines. The structures (excluding the initial structure) consist of characters '.', 'x', and '*'. All other characters are forbidden. A structure (including the initial structure) must have a width and height of at least 1, and there must be at least 1 'x' in it (and at least one '1' in the initial structure). A valid program has to have the initial structure and at least one other structure.
Now, when pattern-matching, the 'x's of the structure are inspected against the recognized space of the field. If every 'x' of a structure has a matching recognized cell on the field, it is a match. If matching occures, the structure is applied on the field: Where there are '.'s, nothing is done, and the field remains there as it was. Where there are 'x's, the matching cells become unrecognized space. Where there are '*'s, those cells are negated -- unrecognized spaces become recognized, recognized become unrecognized.
In this example, the first match would be for the first structure (below the field is still represented with '.'s and '1's (and the representation is of course partial, as the field is infinite in every direction)):
111.......111 1.1.......1.1 111.......111 ...1......... ..1.1........ .1...1.1..... ..1.1........ ...1.........
The 3x3 block of 'x's changed a matching 3x3 block of recognized space unrecognized. The 3x3 block of '*'s negated an 3x3 area so that 8 previously recognized cells became unrecognized, and one unrecognized became recognized. A diamond-like shape was drawn, too, by '*'s, which negated some unrecognized space.
On the next cycle no 3x3 area of 'x's of the first structure is found, and the second structure is tried. It has a match:
..........111 ..1.......1.1 111.......111 ...1......... ..1.1........ .1...1.1..... ..1.1........ ...1.........
Then, on the next cycle, the first structure is tried again. It does not yield matches. The second structure matches again:
............. ..1.........1 111.......111 ...1......... ..1.1........ .1...1.1..... ..1.1........ ...1.........
Then, the next cycle. The first structure has not matches. Neither has the second. Nothing happens, and from that point (cycle 3) onwards nothing ever will.
I am sure the language is Turing-complete, but I have no formal proof of it. I will make a simple Finiteless Cyclic Tag interpreter or something once I am in the right state of mind.
motion.bli - Creates interesting motion of 'particles'.
1.bli - Prints (by drawing on the field) a sequence of integers; 1, 11, 111, 1111, 11111... Goes on forever.
thumor.bli - Keeps creating the Thue-Morse sequence on the field, starting from 0.
Warning: this interpreter suffers from extreme fatigue! I have never tried a slower interpreter. Running the 1.bli program above for 114 cycles took about 4 minutes on my machine...
The interpreter is written in Python and uses pygame for graphics and interactivity (read: simple keyboard input). The interpreter faces difficulties (but should not crash) if recognized space approaches the edges of the screen: the interpreter has a finite field (500x400, and the dimensions can be changed easily in the code) whereas the language uses an infinite field. Make sure to not allow things reach the edge -- Blind has no edges.
The keyboard commands are: up-arrow computes one cycle, F10 sets the program to run automatically, F9 halts it (until either up-arrow or F10 is pressed). Notice that the interpreter, once it is started, is initially halted, and displays the initial structure. Press up or F10 to go!
Here it is: blind.py. Usage: blind.py prog.bli
If you are in need of a spare time project, please write a proper, fast interpreter and link it on Esolang wiki. ;)
-- Keymaker, 9.3.2011