Shatner

Shatner is an esolang created by User:occular.

History
The language was conceived in May 2016, as a possible answer to the question "How could I embody the spirit of William Shatner in a programming language?".

Description
A Shatner program has two parts:


 * A collection of training inputs and outputs
 * The main inputs

An example source file for Shatner:

1,10 10,100  11,110  1000  1100

Each line containing a comma is a pair of training inputs: a binary input followed by a binary output. These are example transformations from input to output for an algorithm that Shatner will try to derive. (In this case, it's binary multiplication by 2.)

The lines without a comma are inputs that Shatner will run through its derived algorithm (should it ever find one that passes all the input/output examples).

Implementing Shatner
Starting at 0, for each positive integer: Convert to base 8. Interpret this base 8 number as a string of Brainfuck commands, as follows:

>  0  <   1  +   2  -   3  .   4 ,   5  [   6  ]   7

Execute this Brainfuck program using all the training inputs in turn. If any training input does not produce the corresponding expected training output, move onto the next integer. If the Brainfuck program doesn't exit after 60 seconds on any input, stop executing it and consider the training input as failed.

If all the training inputs produce the expected training outputs for an integer N, run the found algorithm on the main inputs, sending the outputs to the terminal.