All characters except 0 and 1 are comments and are ignored.
||Increment the memory cell under the pointer|
||Decrement the memory cell under the pointer|
||Move the pointer to the right|
||Move the pointer to the left|
||Input a character and store it at the cell in the pointer|
||Output the character signified by the cell at the pointer|
|| If the cell under the pointer is nonzero, jump back to the previous occurrence of |
|| If the cell under the pointer is zero, jump back to the previous occurrence of |
Program execution ends when there are not enough characters left in the source code to read an entire instruction. A jump with no valid destination also ends program execution.
A jump instruction is 1101 or 0010 followed by any four bits. When the program reaches a jump, it searches backwards or forwards for the corresponding destination instruction - which is the same four bits followed respectively by 1011 or 0100. Execution resumes after the destination instruction.
Since there is no separator between instructions, it is possible (indeed, practically certain) that the same sequence of bits will be interpreted as a different series of instructions after a jump. Coding in Noodle Soup can require multiprogramming because of this.
101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101 010101010001110101010101010101010101010101010101010101010101010101010100011101010101010100011001110101000110101010101010101010101010101 010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100110101010101010101010101010 011101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100011101010101010101010 101010101010101010101010101010001110101000110101010101010011010101010101010100110101010101010101010101010101010101010101010101010101010 1010101010101010101010101010101010101010101010101010101010101010101010101010101001101010101010101010101010101010101010101010101010011
Print 1 2 3 4 5
- Noodle 1
- Starting from the beginning of the source file, increment the first cell 5 times. Then, jump forwards to 1111 0100. The string 11110100 only occurs once in the source:
- Noodle 2
....1111 0100, 1101 1000-
- At the very end of the source file, simply jump back to 1000 1011. Again, this string only appears once in the source.
- Noodle 3
...1000 1011,111,10,0011,000,01,1101 1000...
- This is equivalent to the brainfuck instructions
>+.<-, looping until the first cell is empty. When it is, the program attempts to jump to the next occurence of 1000 1011 - which doesn't exist, so the program terminates. Note that the first ten bits of Noodle 3 overlap the last ten bits of Noodle 1.
- Additional noodles
- Due to the multiprogramming nature of Noodle Soup, there are 4 extra noodles (some incomplete) that were not deliberately added to this code. They are never visited, but might have been if this code were part of a larger program.
-1,01,01,01,01,000,10,111,111,000,1100,0011,10,1100,01,111,01,0011,01,10,00- ...0011 1011,000,111,10,10,01,10,1100,0- ...0101 0100,01,01,111,1100,01,10,000,111,01,10,0011,1101 0011... ...1001 1011,000-