User talk:David.werecat
Mindfuck
« MindFuck - A language based on Brainfuck but the instruction codes change every instruction and data on the tape can suddenly become "missing" ». How about the following:
- The commands
+
,-
,>
,<
,,
,.
,[
and]
are numbered 0, 1...7 - Use lexicographical order on (value in the cell, number of the cell) to virtually reorder the eight cells
ptr
,(ptr+1)
...(ptr+7)
- Reassign the eight commands according to the new order
In case this is unclear, here is an example. Suppose the tape (starting from the cell under the pointer) is 60 22 73 26 20 43 19 22...
. Then the new order is 19(6) 20(4) 22(1) 22(7) 26(3) 43(5) 60(0) 73(2)
Therefore if the next command in the program is:
- '+' (60, 0), interpret it as '[' (6) instead;
- '-' (22, 1), interpret it as '>' (2) instead;
- '>' (73, 2), interpret it as ']' (7) instead;
- '<' (26, 3), interpret it as ',' (4) instead;
- ',' (20, 4), interpret it as '-' (1) instead;
- '.' (43, 5), interpret it as itself (5);
- '[' (19, 6), interpret it as '+' (0) instead;
- ']' (22, 7), interpret it as as '<' (3) instead.
That's a simple permutation, so it may not be as interesting as what you had in mind, but it does change the instruction codes (at almost every use of > or < and at most uses of + - ,). It can be made slightly more confusing by cumulating/composing the successive permutations, instead of always starting over from the initial order +-><,.[]
Koen (talk) 20:48, 8 September 2012 (UTC)