Scuttle is one of those esoteric programming languages, whose purpose is less to make useful programs, but rather to make people (or at least programmers) shudder with horror and question the sanity of the author.
I'd been reading about various esoteric languages and thought I'd try my hand at one of my own. I admired Befunge's style and Brainfuck's simplicity, and so decided to make one based on the two. As an added twist, I decided that pieces of code should be able to move, or scuttle about. I started writing the spec, and decided that the code should be self modifying as well, beyond movement. So far I've implemented only one of the 4 or so code manipulation instructions.
In theory, everything that you can do with a Turing machine since the language supports all of Brainfuck's instructions with only two variations. Like Brainfuck (and unlike Befunge), Scuttle uses an array of memory. Like Befunge (and unlike Brainfuck) program execution can flow in any direction. Code is divided into blocks called rafts, which can move independently of each other. Once set into motion, the raft will continue moving until it either hits another raft, is told to stop, or hits the edge of the program.
The instruction set is as follows:
Instruction | Meaning |
---|---|
+ | Increase value in current memory position |
- | Decrease value in current memory position |
! | Set current memory position to 0 |
a s d f | Move current raft west, north, south or east respectively. |
x | Stop movement of current raft |
h j k l | Change direction of program execution to west, north, south or east respectively. |
< > and ^ v | Store the hexadecimal value indicated between the executed instruction and the corresponding closing one into the current memory position. The order the parts of the hexadecimal value are read in depends on which of the instructions was executed. |
[ ] and ~ _ | Program flow continues at the corresponding closing instruction. The direction that it searches depends on the current memory value. If zero, [ will search west and ] east, ~ up and _ down, otherwise [ will search east and ] west, ~ down and _ up. |
o | Rock. Never moves and never part of a raft. Will stop rafts. A NOP if executed. |
$ | Cannon. Destroys instructions. Which instructions are destroyed depend on the adjacent instructions. If a or h are to its west, the next instruction to the west will be destroyed. Likewise s or j to the north, d or k to the south and f or l to the east. |
) | Move to the next memory position |
( | Move to the previous memory position |
. | Tar. Program execution halts one cycle, but rafts still continue to move. |
" | Prints ASCII character with value equal to current memory position |
# | Prints integer value of current memory position |
? | Gets character from user and stores its ASCII value into current memory position |
@ | Indicates program starting position. Blatent Nethack reference. |
Space | Ends program execution. Freely traversed by rafts. |
Pretty much everything else | Blocks rafts, included in rafts, NOP if executed. |