From Esolang
Jump to navigation Jump to search

NetFuck (also called NF) is an esoteric programming language and is an extension by Daniel Marschall of brainfuck in 2011.

The extension can be implemented in other brainfuck derivates like Malbrain (Malbrain with NetFuck extension).


NetFuck 1.0

NetFuck 1.0 adds 4 additional functionalities to brainfuck:

  • Networking (^, v)
  • Music (*)
  • Timers (~)
  • Terminating the program (&)

Malbrain command order is


This is then called Malbrain with NetFuck 1.0 extension.

NetFuck 1.1

NetFuck 1.1 adds parallel programming to brainfuck using the delimiter | to divide two programs running in 2 different threads. Both threads are using the same memory and the same I/O (network I/O and keyboard-screen I/O). The only thing which is unique to each thread is the program-counter (the current position in the program code). The operator & will kill the whole process and therefore all threads.

Malbrain programs have to be changed to the following command order:


This would then be called Malbrain with NetFuck 1.1 extension. (Not compatible with older extension versions)

Alternativele implementation: You can keep the old command order (without |) and use | directly in the Malbrain code. This would then change the possible commands in Malbrain from >. to >.|


NetFuck can send and receive values. The network connection between two executing NetFuck programs has to be established before. Probably a NetFuck interpreter can do this with a GUI.


Classic notation: ^
ClearBF command: send

Sends the current cell's value to a remote NetFuck program.

Possible implementations:

  • Wait until a client has accepted the value. The pipe has a size of 1 byte (cell).
  • Send the value into a pipe and continue the program. The remote program will pick the value out of the pipe. If the pipe (size is defined by the implementation) is full, then the sender has to wait until there is free space in the pipe again.


Classic notation: v
ClearBF command: recv

Receives a value from the remote NetFuck program and writes it to the current cell.

It there is no value in the pipe, the program will wait until the remote program sends a value.


Bell operation

Classic notation: *
ClearBF command: bell

This command plays a sound based on the current cell's value. The higher the cell value is, the higher is the tone out of the speaker.

Recommended implementation: Unknown. Probably every cell value is one half-tone.


Timer operation

Classic notation: ~
ClearBF command: wait

This command waits according to the current cell's value.

Recommended implementation: Inverval [ms] = cellvalue * 10ms.

Program termination

Classic notation: &
ClearBF command: exit

This command terminates the current program.

This command is probably only rarely needed since usual brainfuck programs usually terminate when the last operation was executes. The exit command can additionally e.g. terminate the program in the middle of a loop.


Simple chat (Teletyper style)

To implement a teletyper style chat (every sign is sent immediately without the need of pressing ENTER) you need following NetFuck programs:

Receiver program:


Sender program:


These programs only need 2 memory cells.

  • 1. Cell: Cell responsible for the loop (constant value: 1)
  • 2. Cell: The value which is sent resp. received (according to the respective program)

Please note, that if you want to chat with a friend, everyone of you needs to run 2 instances of the NetFuck programs:

  • Chat partner A runs a receiver program (to receive messages from B) and a sender program (to send messages to B)
  • Chat partner B runs a receiver program (to receive messages from A) and a sender program (to send messages to A)

Please also note that this program has currently no exit functionality.

As parallel program

Using NetFuck 1.1 you can run sender and receiver program at the same time. Important is that one of the programs has to be changed, so that another cell is used for sending/receiving.

+[>v.<] | +[>>,^<<]

The program uses 3 memory cells:

  • 1. Cell: Cell responsible for the loop (const: 2)
  • 2. Cell: The value which is received
  • 3. Cell: The value which is sent

If you would connect your client to itself, the program will have have the same behavior as the classic brainfuck program


External resources